Open MarcSkovMadsen opened 9 months ago
If someone can confirm that the workarounds are how we would like users to theme their matplotlib and plotly plots then I will add it to the documentation.
Seems like a great idea and doesn't sound super difficult to support.
I would not change the default though, ideally we'd use context managers like:
with plt.style.context('dark_background'):
... # HoloViews evaluation context
It might be an idea to let the matplotlib renderer producere svgs. Insteads of png.
It might be an idea to let the matplotlib renderer producere svgs. Insteads of png.
It does already but I assume you mean changing the default? I'd agree with that.
There is some subtlety to that though, we should ensure that pcolormesh (and possibly imshow if that's not already true) are still rasterized so that we don't output gigantic SVG files for raster based plots.
The
HoloViews
pane has atheme
parameter. But this parameter only works for Bokeh plots.Its just as natural to want other themes for Matplotlib and Plotly backends.
Personally I almost always use the Fast template. And many of my users prefer dark theme. Thus dark theme support would help me a lot.
The same when I demo the flexibility of hvPlot/ HoloViz ecosystem. then for me one of the main selling points is the many supported plotting backends. But its not really True if they are not well supported in Panel. For example in this example https://github.com/holoviz-topics/panel-chat-examples/pull/110 I would like to demonstrate the power of multiple backends. But since the
HoloViews
pane does not support dark theme, I abandoned that idea again.Example
I believe I should be able to use the named Matplotlib and Plotly themes like
dark_background
andplotly_dark
. For example likepn.pane.HoloViews(plot, backend="plotly", theme='plotly_dark')
orIf that is too advanced then just a way to set some dark theme via for all backends via
pn.pane.HoloViews(theme="dark", ...)
would also be a big improvement.Alternative Solutions
An alternative would be documenting how to change the default theme for Matplotlib or Plotly. That would also help a lot.
Plotly Workaround - Change the default theme
For Plotly you can change the default theme using
There is a risk though that the dark theme will be used by a default/ light themed page. So this should probably be run just before setting or updating the
object
in theHoloViews
pane. And the resetting to default right after.Matplotlib Workaround - Change the default theme
You can change the default theme.
You will introduce some risk of another page renderering using
dark_background
when its a default/ light themed page.