-
-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hvplot.extension(compatibility)
does not work?
#1378
Comments
holoviews.opts.defaults(backend)
does not work together?hvplot.extension(compatibility)
does not work?
The Lines 695 to 699 in feffee5
You could open a feature request for HoloViews to see if it could be implemented there too. |
I am using def select_and_plot(_data: xarray.DataArray | xarray.Dataset, _indexers: dict[str | None, Any], backend: str, _plot_opts: dict[str,Any]) -> holoviews.Curve:
nonlocal x, transform, label
# Workaround in plot_opts because `compatibility` does not work properly
apply_plot_opts = _plot_opts.copy()
# if backend == "matplotlib":
# for bokeh_key in list(apply_plot_opts.keys()):
# if bokeh_key in MATPLOTLIB_TRANSFORMS["style"]:
# opt_transform = MATPLOTLIB_TRANSFORMS["style"][bokeh_key]
# bokeh_val = apply_plot_opts.pop(bokeh_key)
# if opt_transform != UNSET:
# new_key, new_val = opt_transform(bokeh_key, bokeh_val)
# apply_plot_opts[new_key] = new_val
hvplot.output(backend=backend)
plot_data = _data
if None in _indexers:
plot_data = plot_data[_indexers[None]]
plot_data = plot_data.sel(**{k: v for k, v in _indexers.items() if k in _data.dims})
plot_data = plot_data.dropna(x, how="all")
curve: holoviews.Curve = plot_data.hvplot(kind=kind, x=x, label=label, **apply_plot_opts)
return curve |
Sorry, that wasn't clear from the OP. I'm going to re-open, can you please post a minimal reproducible example that includes hvPlot code and that shows the compatibility doesn't work, screenshot appreciated. |
Here's my mwe import hvplot.xarray
import holoviews
import xarray
hvplot.extension("bokeh", "matplotlib", compatibility="bokeh")
data1 = xarray.DataArray([0, 1, 2])
data1.name="Needs a name"
data2 = data1 + 1
hvplot.output(backend="matplotlib")
overlay = holoviews.Overlay()
curve_line1 = data1.hvplot(kind="line")
curve_line2 = data2.hvplot(kind="line", line_dash="dashed")
overlay *= curve_line1
## This one does not seem to work
curve_line1.opts(line_dash="dashed")
overlay *= curve_line2
overlay |
Ah ok you're referring to this line |
Ok, got it, still had some issues but probably all are related to #1380. Initially I did put all of those options inside the Edit: I've tried it again, and indeed it works (except for #1380 and such), I probably was using |
Aaah, I remember the issue: # Note: `hvplot.extension(compatibility)` does not work with `holoviews.opts.defaults(backend)`
hvplot.extension("bokeh", "matplotlib", compatibility="bokeh")
# hvplot.extension("bokeh", "matplotlib")
holoviews.opts.defaults(
holoviews.opts.Curve(
fig_size=500,
linewidth=1,
),
backend="matplotlib",
) when I use |
Ok. Tbh I'm not sure they get ignored as hvPlot sets some options by default. For example, hvPlot definitely overrides the default width/height of HoloViews, so I'd expect |
Primarily it's the |
Firstly, I'm building on top of holoviz/holoviews#6331 in order to get
holoviews.opts.defaults(backend)
to actually work. But then thecompatibility
does not seem to work anymore. Here's a MWE.After further debugging with this example, I couldn't get it to work in any combination. The version of
hvplot
I am working with is0.10.0
The text was updated successfully, but these errors were encountered: