Plot lines and group with changing linestyle and color

Let’s say I want to plot something like

data.hvplot(kind="line", x="t", by=["var1", "var2"])

How can I control the style for each var1/var2, e.g. one to vary line-style the other to vary color?

Alternatively, how can one use holoviews.Layout/holoviews.Overlay to iteratively add plots on the same axis?

I don’t think it’s possible in one call; you probably have to do this.

data.hvplot(kind="line", x="t", "var1", **styling_kwargs) * data.hvplot(kind="line", x="t", "var2", **styling_kwargs)

For your second question, just pretend hv.Layout or hv.Overlay` is a list and “append” to it.

overlay = hv.Overlay()
for var in ["var1", "var2"]:
    overlay *= data.hvplot(kind="line", x="t", var, **styling_kwargs)

Alternatively, do something more familiar in Python: collect all results, and then just call Overlay on it

plots = []
for var in ["var1", "var2"]:
    plots.append(data.hvplot(kind="line", x="t", var, **styling_kwargs))
hv.Overlay(plots)

Great, that indeed did the job. I’ve opened another issue about how to control the order of the styling index