-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Backend-specific option ignored #4962
Comments
I can reproduce, both with .options and with .opts. That's very surprising! |
Agreed. Definitely looks like a bug. |
It looks like changing the default backend with
|
That's a good suggestion, and a useful bit of code I'd be happy to see in HoloViews (potential PR?). I'd maybe call it just |
I'll see what I can do wrt to PR, as there is a bunch of other things I'd like to give a go at fixing. It may take a (long) while though, as I need to seek legal approval from my company first. |
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Helper context manager to Work around: holoviz/holoviews#4962
Take into account the backend the options are set on when creating a new option tree. Otherwise, custom options set for a backend that is not the current one will simply be discared, and only the new options will survive. Fixes holoviz#4962
Thanks, @philippjfr! I'd still be happy to see |
@jbednar I'm happy to add that as well, which module should it live in ? |
I'm not sure how useful a context manager like this is in a notebook context: afaik anything inside the context manager block won't automatically get displayed by the usual notebook machinery (unless you explicitly trigger display, which is awkward). I have no objection to this idea but I would need to be shown some example use cases first to be convinced that it is useful. |
Yes, it's very irritating that a context manager has no return value that Jupyter can display. In this case, though, the intent is to use the decorator to set options "in bulk", i.e. likely for a bunch of objects, none of which are expected to be displayed immediately. The intent is for pre-setting values for diffferent backends ahead of time, because otherwise there would be no need to use this mechanism; anything immediately displayed would only need to be supported for one backend, not flexibly switching as this context manager focuses on. |
Ok, I wouldn't anticipate this being a common need but that doesn't mean it can't be supported. |
By the way, I think as option logic this should live together with |
Actually, with hv.Store.backend('bokeh'):
... |
This could probably be bundled with a way to temporarily override some global default options used when creating new plots, e.g.:
This can allow people to create some sort of themes, while still letting through all the global defaults that the theme does not explicitly override. The code creating the plots themselves will still be able to override the defaults where it is really necessary for e.g. readability. A library cannot currently apply its own "local defaults" without changing the user's global defaults. With context managers, it becomes possible to have an arbitrary number of theming layers rather than just one. Note: there seems to be a StoreOptions.options() context manager but it looks like it is limited to operating on one object, rather than the whole global defaults. EDIT: changed the comment on how nesting of "with" should work: it makes more sense for the outer levels to override the inner levels, as the user will ultimately be in charge of the top-level.
|
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
ALL software version info
holoviews: 1.14.3
matplotlib: 3.4.2
bokeh: 2.3.2
Description of expected behavior and the observed behavior
Disclaimer: I'm a new user and I had to dive straight pretty deep to support my use case, API misuse is not unlikely.
When setting backend-specific options for a non-default backend, the calls to options() seem to override each-other.
Complete, minimal, self-contained example code that reproduces the issue
Screenshots or screencasts of the bug in action
The text was updated successfully, but these errors were encountered: