3D scatter plots in Lightning


Setup


In [1]:
from lightning import Lightning

from numpy import random, asarray, amin, concatenate, column_stack 
from seaborn import color_palette
from sklearn import datasets

Connect to server


In [2]:
lgn = Lightning(ipython=True, host='http://public.lightning-viz.org')


Lightning initialized
Connected to server at http://public.lightning-viz.org


Random points with default styling


In [3]:
n = 100
x = random.rand(n)*100
y = random.rand(n)*100
z = random.rand(n)*100

lgn.scatter3(x,y,z)


Out[3]:


Random small red points


In [4]:
n = 100
x = random.rand(n)*100
y = random.rand(n)*100
z = random.rand(n)*100
c = [240,117,145]

lgn.scatter3(x,y,z,size=4,color=c)


Out[4]:


Random points with all styling options


In [5]:
n = 100
x = random.rand(n)*100
y = random.rand(n)*100
z = random.rand(n)*100
c = [asarray(color_palette('Blues', 100)[random.choice(range(100))])*255 for i in range(n)]
s = random.rand(n)*8+1

lgn.scatter3(x, y, z, color=c, size=s)


Out[5]:


Fun with colors


In [6]:
n = 500
x = random.rand(n)*255
y = random.rand(n)*255
z = random.rand(n)*255
c = column_stack((x,y,z))

lgn.scatter3(x,y,z,color=c, size=3)


Out[6]: