Stacked line plots in Lightning


Setup


In [1]:
import os
from lightning import Lightning

from numpy import random, asarray, argsort
from scipy.ndimage.filters import gaussian_filter
from sklearn import datasets
from seaborn import color_palette

In [2]:
# replace with your own host and credentials, e.g. http://localhost:3000 or http://my-lightning-server.herokuapp.com
host = 'http://lightning-docs.herokuapp.com'
auth = (os.getenv('LIGHTNING_USERNAME'), os.getenv('LIGHTNING_PASSWORD'))

In [3]:
lgn = Lightning(ipython=True, host=host, auth=auth)
lgn.create_session('linestacked-ipython');

Stacked line with default styles

The stacked line is an interactive chart for plotting multiple lines.
It allows you to select lines from a minimap to compare subsets. Styling is similar to normal line plots.


In [4]:
y = gaussian_filter(random.rand(5,100), [0, 3])
lgn.linestacked(y, size=6)


Out[4]:

Stacked line for clustered data


In [5]:
d, l = datasets.make_blobs(n_features=20, n_samples=20, centers=5, cluster_std=1.5, random_state=100)
inds = argsort(l)
lgn.linestacked(d[inds,:], label=l[inds])


Out[5]: