Ipyleaflet with vaex

Repository: https://github.com/vaexio/vaex

Installation:

conda install -c conda-forge vaex


In [ ]:
import vaex
import numpy as np
np.warnings.filterwarnings('ignore')
dstaxi = vaex.open('src/nyc_taxi2015.hdf5') # mmapped, doesn't cost extra memory

In [ ]:
dstaxi.plot_widget("pickup_longitude", "pickup_latitude", f="log", backend="ipyleaflet", shape=600)

In [ ]:
dstaxi.plot_widget("dropoff_longitude", "dropoff_latitude", f="log", backend="ipyleaflet",
                   z="dropoff_hour", type="slice", z_shape=24, shape=400, z_relative=True,
                   limits=[None, None, (-0.5, 23.5)])

In [ ]:
ds = vaex.datasets.helmi_de_zeeuw.fetch()

In [ ]:
ds.plot_widget("x", "y", f="log", limits=[-20, 20])

In [ ]:
ds.plot_widget("Lz", "E", f="log")

ipyvolume

  • 3d plotting for Python in the Jupyter notebook based on IPython widgets using WebGL
  • Glyphs, volume rendering, surfaces/meshes/lines/isosurfaces
  • Live documentation http://ipyvolume.readthedocs.io/en/stable/
  • Installation
    • $ conda install -c conda-forge ipyvolume
    • $ pip install ipyvolume

In [ ]:
import ipyvolume as ipv
import numpy as np
np.warnings.filterwarnings('ignore')

In [ ]:
ipv.example_ylm();

In [ ]:
N = 1000
x, y, z = np.random.random((3, N))

In [ ]:
fig = ipv.figure()
scatter = ipv.scatter(x, y, z, marker='box')
ipv.show()

In [ ]:
scatter.x = scatter.x + 0.1

In [ ]:
scatter.color = "green"
scatter.size = 5

In [ ]:
scatter.color = np.random.random((N,3))

In [ ]:
scatter.size = 2

In [ ]:
ipv.figure()
ipv.style.use('dark')
quiver = ipv.quiver(*ipv.datasets.animated_stream.fetch().data[:,::,::4], size=5)
ipv.animation_control(quiver, interval=200)
ipv.show()

In [ ]:
ipv.style.use('light')

In [ ]:
quiver.size = np.random.random(quiver.x.shape) * 10

In [ ]:
quiver.color = np.random.random(quiver.x.shape + (3,))

In [ ]:
quiver.geo = "cat"

In [ ]:
# stereo

In [ ]:
quiver.geo = "arrow"

In [ ]:
N = 1000*1000
x, y, z = np.random.random((3, N)).astype('f4')

In [ ]:
ipv.figure()
s = ipv.scatter(x, y, z, size=0.2)
ipv.show()

In [ ]:
s.size = 0.1

In [ ]:
#ipv.screenshot(width=2048, height=2048)

In [ ]:
plot3d = ds.plot_widget("x", "y", "z", vx="vx", vy="vy", vz="vz",
                        backend="ipyvolume", f="log1p", shape=100, smooth_pre=0.5)

In [ ]:
plot3d.vcount_limits = [50, 100000]

In [ ]:
plot3d.backend.quiver.color = "red"

In [ ]:
import ipywidgets as widgets

In [ ]:
widgets.ColorPicker()

In [ ]:
widgets.jslink((plot3d.backend.quiver, 'color'), (_, 'value'))

In [ ]:
ipv.save("kapteyn-lunch-talk-2018.html")

In [ ]:
!open kapteyn-lunch-talk-2018.html

In [ ]:
# webrtc demo if time permits

A Billion stars in the Jupyter notebook


In [ ]:
import vaex
#gaia = vaex.open("ws://gaia:9000/gaia-dr1")
gaia = vaex.open('/Users/maartenbreddels/datasets/gaia/gaia-dr1-minimal_f4.hdf5')
%matplotlib inline

In [ ]:
f"{len(gaia):,}"

In [ ]:
ra_dec_limits = [[0, 360], [-90, 90]]

In [ ]:
gaia.set_active_fraction(0.01)

In [ ]:
gaia.plot_widget("ra", "dec", limits=ra_dec_limits)

In [ ]:
gaia.mean("phot_g_mean_mag", selection=True)

In [ ]:
gaia.plot1d("phot_g_mean_mag", selection=False, n=True, limits=[10, 22])
gaia.plot1d("phot_g_mean_mag", selection=True, show=True, n=True, limits=[10, 22])

In [ ]:


In [ ]:


In [ ]:


In [ ]: