How do I change the default color cycle for holoviews (for my Panel app)

I’m developing a Panel app with a customized look and feel.

Now I’m trying to change the default color map of Holoviews before I panel.serve my apps.

Currently it looks like

Its actually good. But I need to change it to a specific color scheme for corporate reasons.

I’ve tried playing around with the instructions from http://holoviews.org/user_guide/Colormaps.html, http://holoviews.org/user_guide/Styling_Plots.html and http://holoviews.org/user_guide/Applying_Customizations.html without luck.

For example setting

hv.Cycle.default_cycles["default_colors"] = colors.COLOR_CYCLE

where colors.COLOR_CYCLE is a list of colors.

or setting

opts.defaults(
        color=hv.Cycle(colors.COLOR_CYCLE)
    )

But without luck.

I can though change the color opts each time I generate a plot via

curve_opts = opts.Curve(line_width=4, responsive=True, color=hv.Cycle(colors.COLOR_CYCLE))
return data.hvplot(x="Datetime", y="Value", by="ElementName").opts(
    curve_opts
)

But I would like to avoid that.

@Marc Hi! I wonder did you found how to change the default color cycle without using the color option manually each time ?

You should be able to do it by passing it to hv.opts.defaults(curve_opts).

1 Like

So, there is no way to define any default options shared by all elements?

This makes it hard to implement any notion of a general aesthetic theme.

Try this: Set default plot size for all plot types? - #3 by Hoxbro

You can try using Bokeh themes
Create publication-styled figures with hvPlot using the Bokeh backend | by Andrew Huang | Jan, 2024 | Medium