Context: I have a parametrised function that spits out data which I want to visualise live (using a DynamicMap). For some of the parameters, the evaluation is dramatically more efficient overall if supplied with a vector of all the values I’m interested in than it would be to evaluate for those values one-by-one. The most obvious solution to me is to have an outer layer of parameters that should trigger a reevaluation in the DynamicMap, and an inner HoloMap which lets me scrub through the pre-computed values.
However, when I try to do this I get the warning No plotting class for HoloMap found
. I can visualise the resultant DynamicMap using e.g. the .layout() method, but I want it to look as if all the parameters were treated the same.
That came out really garbled, so here’s some examples to explain what I mean. I want to make test_dynamicmap
produce the same output that test_holomap()
does. test_dynamicmap.layout()
gets me halfway there, but I don’t want three plots next to each other, I want one plot with a widget.
phases = [0, 1, 2]
frequencies = [0.5, 0.75, 1.0, 1.25]
def sine_curve(phase, freq):
xvals = [0.1* i for i in range(100)]
return hv.Curve((xvals, [np.sin(phase+freq*x) for x in xvals]))
def test_holomap1():
curve_dict = {(p,f):sine_curve(p,f) for p in phases for f in frequencies}
hmap = hv.HoloMap(curve_dict, kdims=['phase', 'frequency'])
return hmap
def test_holomap2(phase):
curve_dict = {f:sine_curve(phase,f) for f in frequencies}
hmap = hv.HoloMap(curve_dict, kdims='frequency')
return hmap
test_dynamicmap = hv.DynamicMap(test_holomap2, kdims=['Phase']).redim.values(Phase=phases)