In [3]:
import numpy as np
import vaex as vx
import pylab
ds = vx.open("/home/data/gavi/Aq-A-2-999-shuffled-10percent.hdf5")
print ds
#server = vx.server("localhost")
#ds = server.open("../data/Aq-A-2-999-shuffled-1percent.hdf5")
%matplotlib inline
table
<vaex.dataset.Hdf5MemoryMapped object at 0x2b16b32a7890>
Out[3]:
<vaex.dataset.Hdf5MemoryMapped at 0x2b156c198cd0>

Simplest example

The default for plot is to calculate the mean +/- 3 sigma for the limits, and plot the density plot

In [4]:
subspace = ds("x", "y")
subspace.plot(f=np.log)

More control

For more control, you can find the limits yourself, with minmax or limits_sigma, do the histogram, and let vaex handle the plotting.

Vaex uses matplotlib, so any matplotlib routines before and afterwards are fine.

In [5]:
limits = subspace.limits_sigma(square=True, sigmas=0.4)
means = subspace.mean()
print "limits", limits
limits [[ 56.19850387  57.53320609]
 [ 51.74976341  53.08446563]]
In [6]:
grid = subspace.histogram(size=256, limits=limits)
In [7]:
pylab.figure(num=None, figsize=(10, 10), dpi=80, facecolor='w', edgecolor='k')
subspace.plot(np.log10(grid+1), limits, center=means)
pylab.scatter(0, 0)
Out[7]:
<matplotlib.collections.PathCollection at 0x2b16b339b510>

More control

Extra keywords will be passed to pylab.imshow, such as cmap for the colormap

In [8]:
limits = subspace.limits_sigma(sigmas=4, square=True)
grid = subspace.histogram(size=512, limits=limits)
pylab.figure(num=None, figsize=(10, 10), dpi=80, facecolor='w', edgecolor='k')
subspace.plot(grid, limits=limits, f=np.log1p, cmap='afmhot')