import numpy as np import pandas as pd import holoviews as hv hv.extension('bokeh', 'matplotlib') xs = np.arange(10) ys = np.exp(xs) table = hv.Table((xs, ys), 'x', 'y') table (hv.Scatter(table) + hv.Curve(table) + hv.Area(table) + hv.Bars(table)).cols(2) print(hv.Scatter({'x': xs, 'y': ys}) + hv.Scatter(np.column_stack([xs, ys])) + hv.Scatter(pd.DataFrame({'x': xs, 'y': ys}))) print(hv.Scatter(ys) + hv.Scatter((xs, ys)) + hv.Scatter(zip(xs, ys))) df = pd.DataFrame({'x': xs, 'y': ys, 'z': ys*2}) print(type(hv.Scatter(df).data)) hv.Dataset.datatype print(type(hv.Scatter((xs.astype('float64'), ys), datatype=['array']).data)) print(type(hv.Scatter((xs, ys), datatype=['dictionary']).data)) print(type(hv.Scatter((xs, ys), datatype=['dataframe']).data)) overlay = hv.Scatter(df, 'x', 'y') * hv.Scatter(df, 'x', 'z') overlay overlay.Scatter.I.data is overlay.Scatter.II.data table.array() table.dframe().head() table.columns() xs = np.arange(10) curve = hv.Curve(zip(xs, np.exp(xs))) curve * hv.Scatter(curve) + curve.table() curve.dframe() %%opts Points (s=200) [size_index=None] extents = (-1.6,-2.7,2.0,3) np.random.seed(42) mat = np.random.rand(3, 3) img = hv.Image(mat, bounds=extents) raster = hv.Raster(mat) img * hv.Points(img) + img.table() + \ raster * hv.Points(raster) + raster.table() obs_hmap = hv.HoloMap({i: hv.Image(np.random.randn(10, 10), bounds=(0,0,3,3)) for i in range(3)}, kdims='Observation') obs_hmap %%output backend='matplotlib' %%opts Layout [fig_size=150] Scatter3D [color_index=3 size_index=None] (cmap='hot' edgecolor='k' s=50) obs_hmap.table().to.scatter3d() + obs_hmap.table() %%opts Image [width=225 height=225] from itertools import product extents = (0,0,3,3) error_hmap = hv.HoloMap({(i, j): hv.Image(j*np.random.randn(3, 3), bounds=extents) for i, j in product(range(3), np.linspace(0, 1, 3))}, kdims=['Observation', 'noise']) noise_layout = error_hmap.layout('noise') noise_layout noise_layout.table() bars = hv.Bars((['C', 'A', 'B', 'D'], [2, 7, 3, 4])) (bars + bars.sort().relabel('sorted') + bars.sort(['y']).relabel('y-sorted') + bars.sort(reverse=True).relabel('reverse sorted')).cols(2) n = np.arange(1000) xs = np.repeat(range(2), 500) ys = n%4 zs = np.random.randn(1000) table = hv.Table((xs, ys, zs), ['x', 'y'], 'z') table hv.BoxWhisker(table) %%opts Bars {+axiswise} hv.Bars(table).aggregate('x', function=np.mean) + hv.Bars(table).reduce(x=np.mean) hmap = hv.HoloMap({i: hv.Curve(np.arange(10)*i) for i in range(10)}) collapsed = hmap.collapse(function=np.mean, spreadfn=np.std) hv.Spread(collapsed) * hv.Curve(collapsed) + collapsed.table()