Stacked/overlapping lineplots

For the purpose of searchability, how can we plot stacked line plots. The following does not work:

data.hvplot(kind="line", x="x", y="y" stacked=True)

For the purpose of the example, let’s say it is an x/y plot and we want to stack according to the z dimension as plot["y"] = data["y"] + offset * data["z"]

Bonus, how to control the stacking, e.g. If we want them stacked in the negative direction.


One possible approach is to loop over the data manually:

overlay = holoviews.Overlay()
for z_val in data["z"]:
    plot_data = data.sel(z=z_val) + offset * z
    overlay *= plot_data.hvplot(kind="line", x="x", y="y")