Notebook for testing lightning plotting in the iPython notebook

You should be running a local lightning server to execute this notebook as specified below. If you are running your own server, replace the host accordingly.

In [1]:
from lightning import Lightning
host='http://localhost:3000'
lgn = Lightning(ipython=True, host=host)

In [2]:
from numpy import random, ceil, vstack
from scipy.ndimage.filters import gaussian_filter

Scatter


In [3]:
x = random.randn(50)
y = random.randn(50)
l = ceil(random.rand(50)*5)
lgn.scatter(x,y, label=l)


Out[3]:

Line


In [4]:
ts = gaussian_filter(random.randn(5,50), [0, 2])
lgn.line(ts)


Out[4]:

Scatter Line


In [5]:
x = random.randn(50)
y = random.randn(50)
ts = random.randn(5,50)
l = ceil(random.rand(50)*5)
lgn.scatterline(x,y,ts,label=l)


Out[5]:

Force


In [107]:
mat = random.rand(50,50)
mat[mat<0.975] = 0
l = ceil(random.rand(50) * 5)
lgn.force(mat, label=l)


Out[107]:

Graph


In [32]:
x = random.randn(50)
y = random.randn(50)
mat = random.rand(50,50)
mat[mat<0.9] = 0
l = ceil(random.rand(50) * 5)
lgn.graph(x, y, mat, label=l)


Out[32]:

Graph bundled


In [31]:
x = random.randn(50)
y = random.randn(50)
mat = random.rand(50,50)
mat[mat<0.9] = 0
l = ceil(random.rand(50) * 5)
lgn.graphbundled(x, y, mat, label=l)


Out[31]:

Matrix


In [125]:
mat = random.rand(20,20)
lgn.matrix(mat, colormap="Purples")


Out[125]:

Adjacency


In [47]:
mat = random.rand(20,20)
mat[mat<0.75] = 0
l = ceil(random.rand(20) * 5)
lgn.adjacency(mat, label=l)


Out[47]:

Image


In [101]:
im = gaussian_filter(random.rand(256,512, 3)*3, [5, 5, 0])
lgn.image(im)


Out[101]:

In [127]:
im1 = gaussian_filter(random.rand(256,512, 3)*3, [5, 5, 0])
im2 = gaussian_filter(random.rand(256,512, 3)*3, [5, 5, 0])
im3 = gaussian_filter(random.rand(256,512, 3)*3, [5, 5, 0])
lgn.gallery([im1, im2, im3])


Out[127]:

Map


In [7]:
regions = ["NA", "AK", "AL", "AR", "AZ", "CA", "CO","CT","DC","DE","FL","GA","HI","IA","ID"]
weights = random.randn(len(regions))
lgn.map(regions, weights, colormap="Purples")


Out[7]: