4

Is it possible to generate HoloMaps using hvPlot ? I have not found any reference in the documentation.

The goal is to create something like the examples here: http://holoviews.org/reference/containers/bokeh/HoloMap.html#bokeh-gallery-holomap

but using the hvPlot interface

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96
AleAve81
  • 275
  • 3
  • 8

1 Answers1

5

This is definitely possible, the main requirement is that your data is in a tidy format. Once that's the case you can use the groupby keyword to get a DynamicMap or HoloMap which explores the data along that dimension. For example let us adapt the example in the link you pointed to:

frequencies = [0.5, 0.75, 1.0, 1.25]

def sine_curve(phase, freq):
    xvals = np.arange(100)
    yvals = np.sin(phase+freq*xvals)
    return pd.DataFrame({'x': xvals, 'y': yvals, 'phase': phase, 'freq': freq}, columns=['x', 'y', 'phase', 'freq'])

df = pd.concat([sine_curve(0, f) for f in frequencies])

df.hvplot.line('x', 'y', groupby='freq', dynamic=False)

enter image description here

Here we create a DataFrame with x and y values for a number of different frequencies, concatenate them and then apply a groupby along the 'freq' column to get a slider for that dimension. To ensure that it returns a HoloMap rather than a DynamicMap we also set dynamic=False.

philippjfr
  • 3,997
  • 14
  • 15
  • thanks, so groupby is the key here. It would be nice if you can add this example to the docs (unless I missed something similar already there). – AleAve81 May 24 '19 at 14:25