from lightning import Lightning
from numpy import random, asarray
lgn = Lightning(ipython=True, host='http://public.lightning-viz.org')
Circle plots show connections between nodes in a graph as lines between points around a circle. Let's make one for a set of random, sparse connections.
connections = random.rand(50,50)
connections[connections<0.98] = 0
lgn.circle(connections)
We can add a text label to each node. Here we'll just add a numeric identifier. Clicking on a node label highlights its connections -- try it!
connections = random.rand(50,50)
connections[connections<0.98] = 0
lgn.circle(connections, labels=['node ' + str(x) for x in range(50)])
Circle plots are useful for visualizing hierarchical relationships. You can specify multiple levels of grouping using a nested list. Let's start with one.
connections = random.rand(50,50)
connections[connections<0.98] = 0
group = (random.rand(50) * 3).astype('int')
lgn.circle(connections, labels=['group ' + str(x) for x in group], group=group)
And now try adding a second level. We'll label by the second group to make clear what's going on. If you click on any of the outermost arcs, it will highlight connections to/from that group.
connections = random.rand(50,50)
connections[connections<0.98] = 0
group1 = (random.rand(50) * 3).astype('int')
group2 = (random.rand(50) * 4).astype('int')
lgn.circle(connections, labels=['group ' + str(x) for x in group2], group=[group1, group2])