Workbooks

  • Workbooks allow users to persist the analytic state of a visualization, including active filters, exclusions, and color encodings.
  • PyGraphistry users can set the workbook via .settings(url_params={'workbook': 'my_workbook_id'})
    • See bottom example
  • Workbooks are not bound to any particular dataset, meaning that the same workbook can be used across many different dataset.
    • This design allows workbooks to be shared amongst analysts, even if they have different access permissions to the data.
    • Additionally, for on-premise costumers who require a 'read-process-discard' security model, workbooks allow you to resume an investigation even if the last dataset was discarded.
    • This design is also valuable to analyze time-dependent datasets. For example, a user can reuse the same workbook to analyze a graph of the day's highest priority security events.
    • Or alternatively, different datasets that represent similar entities and connections (In this tutorial, we use one workbook to examine two different social networks graphs)

Import the necessary libaries


In [6]:
import time
from IPython.display import IFrame

Set the location of the graphistry server

  • To use our public server, use labs.graphistry.com

In [2]:
SERVER = 'labs.graphistry.com'

Let's first take a look at a subgraph of Facebook's social network, and create a new workbook named popularCommunities


In [3]:
current_time = str(int(time.time()))
dataset='Facebook'
# We add the current time to the end of the workbook name to ensure it is unique
workbook = 'popularCommunities' + current_time

In [4]:
current_time = str(int(time.time()))
url = 'http://' + SERVER + '/graph/graph.html?dataset=' + dataset + '&workbook=' + workbook + '&splashAfter=' + current_time
IFrame(url, width=1000, height=500)


Out[4]:
  1. Click on the filter button in the toolbar to the left.
  2. In the 'Select attribute to filter' input box, type: 'point:degree' and then click enter
  3. Change the filter to point:degree >= 100
  4. Make sure to save the workbook by clicking on the floppy disc icon at the bottom of the toolbar. ##### The workbook should now be saved. Refresh the page to confirm the filter has persisted

In this example, we examime a social network made from the characters in Marvel comic books.


In [5]:
current_time = str(int(time.time()))
dataset='Marvel'
url = 'http://' + SERVER + '/graph/graph.html?dataset=' + dataset + '&workbook=' + workbook + '&splashAfter=' + current_time
IFrame(url, width=1000, height=500)


Out[5]:

Confirm the filter has been persisted, by clicking on the filters button, and checking that 'point:degree > 100' is an active filter

For comparison, the following vizualization was created without the workbook


In [ ]:
current_time = str(int(time.time()))
dataset='Marvel'
url = 'http://' + SERVER + '/graph/graph.html?dataset=' + dataset + '&splashAfter=' + current_time
IFrame(url, width=1000, height=500)

In [9]:
import pandas as pd
import graphistry
#graphistry.register(key='my_api_key', server='labs.graphistry.com')

edges_1_df = pd.DataFrame({'s': [0,1,2], 'd': [1,2,0]})
edges_2_df = pd.DataFrame({'s': [0,1,2, 3], 'd': [1,2,0,1]})

In [10]:
g = graphistry.bind(source='s', destination='d').settings(url_params={'workbook': 'my_' + workbook})

Use with pygraphistry

  • Set via .settings(url_params={'workbook': 'my_workbook_id'})
  • Reuse across plots

In [11]:
g.plot(edges_1_df)


Out[11]:

In [12]:
g.plot(edges_2_df)


Out[12]:

In [ ]: