This is my simplified code:
low1 = [1, 2, 3]
low2 = [3, 2, 1]
high = [1000, 2000, 3000]
lowCurve1 = hv.Curve(low1)
lowCurve2 = hv.Curve(low2)
lowCurves = dict(one=lowCurve1, two=lowCurve2)
highCurve = hv.Curve(high)
highCurves = dict(one=highCurve)
class LowHigh(param.Parameterized):
lhSelect = param.Selector(default='high', objects=['low','high'])
lh = LowHigh()
def makeLHPlot(someCurves):
allGraph = hv.NdOverlay(someCurves)
return allGraph
@pn.depends(LowHigh.param.lhSelect, watch=True)
def updateLHGraph(lhSelect):
print('updateLHGraph:', lhSelect)
if lhSelect == 'high':
return (makeLHPlot(highCurves) + makeLHPlot(highCurves)).cols(1)
else:
return (makeLHPlot(lowCurves) + makeLHPlot(highCurves)).cols(1)
pn.Column(pn.pane.Markdown('# Panel plot simple example'),
LowHigh.param.lhSelect,
updateLHGraph
)
I have 2 questions:
a. When I click on the selector, the updateLHGraph function is called twice. Why? How to avoid this?
b. When one low and on high graph are displayed, the y-axis on the low takes its values from high (i.e., goes from 0 to 3000+ and not from 0 to 3+). How can I get this to optimize itself for the low values? I tried setting axiswise=False in the Curve opts, but to no avail.