1
votes

How do I add y-limits (ylim) to a plot created using Holoviews Datashader?

I have tried the hv.Dimension function and also adding ylim=() parameters but it would either be the Holoview that rejects it or the Datashader function that doesn't understand the parameter.

plot_Z1 = datashade(hv.Curve(df).redim(y=hv.Dimension('y', range=(-50,50))))
plot_Z2 = datashade(hv.Curve(df).redim(y=hv.Dimension('y', range=(-50,50))))

plot_Z1.options(width=500) + plot_Z2.options(width=500)

ylim isn't recognized and hv.Dimension has no effect

1
I can't seem to reproduce any issue with the code you have provided, the dimension range works for me and at least since 1.11.0 ylim is recognized as an option.philippjfr

1 Answers

1
votes

It would appear that I cannot use ylim and shared_axes together with Holoview datashading. At least not in the sense where shared_axes works properly that it will zoom in/out on all subplots together. If I stick to just Holoviews either it won't apply the ylim or the shared_axes won't zoom in/out on all subplots (only one plot with zoom while others stay still).

The only way I found to get shared_axes working properly together with a ylim parameter is using HVPLOT instead.

plot_1 = df.hvplot(y='Something', width=200, datashade=True)
plot_2 = df.hvplot(y='Something Else', width=200, ylim=(-50, 50), datashade=True)
plot = (plot_1 + plot_2.options(shared_axes=True)).cols(1)
plot