Skip to content
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

Opts and the plugin tools are inconsistent and not properly documented #5231

Open
GilShoshan94 opened this issue Mar 10, 2022 · 1 comment
Open

Comments

@GilShoshan94
Copy link
Contributor

Hi,
It is not exactly a bug nor a feature request.
It is more an error in the documentation I would say that does not cover a special case and took me some time to find the correct way to do.
There is also some inconsistencies.

I use Holoviews with Bokeh, I don't know if those "inconsistencies" exist because of other optional backend such as Plotly.

ALL software version info

Python 3.9
bokeh 2.4.2
holoviews 1.14.8

Description of expected behavior and the observed behavior

From the Holoviews User Guide, I expected the tools to be deactivated by default (that's why we have an active_tools setting), I see that a set of tools are defined as default (default_tools ['save', 'pan', 'wheel_zoom', 'box_zo...) but that we can overwrite it with anything, and the tools setting feels like a duplicate setting with default_tools. I expected to have only the tools setting with the default value of default_tools


  1. Without specifying any active_tools, we get by default de "pan" tool active. While I think this is a good default, this is a bit inconsistent with the option active_tools which, according to the help (I used hv.help(hv.Curve)) is an empty list.
    image

By reading the documentation of Bokeh I understand that the underlying setting is set to "auto" in Bokeh and that's how it behave. But as a user of Holoviews, I believe it makes more sense to have it set to "None" by default in Bokeh and have a sensitive default (like ["pan"]) for active_tools.


  1. If a user set tools with tools that are already presents in the default_tools, we get duplicated widget such as this:
    image

While I don't think it is necessary for Holoviews/Bokeh to add logic to remove duplicate, (in the case a user explicitly write tools = ["box_zoom", "box_zoom"] for exemple), I do think that we have a duplicate of settings here, the tools and default_tools are basically the same, so I think default_tools should be removed and instead tools should have a default value.


  1. While I throught that unless I set active_tools the tool would not be active by default, I tried to set "box_zoom" active and it worked, then I added to tools the "hover" and when I added it to the list of active_tools, I an error with a whole traceback and was quiet hard for me to understand what I did wrong.
    image

I found the solution in the Bokeh documentation
image

And I understood that for inspect tools, I need to specify a list, so the correct way to do is:
image

This was confusing and think it should either be documented or Holoviews should still expect a list and parse it itself for this case before passing it on to Bokeh.


  1. This is a consequence from point 1, how do I add tools without having it active by default such a "hover" from Holoviews ?

Complete, minimal, self-contained example code that reproduces the issue

import numpy as np
import pandas as pd
import holoviews as hv
from holoviews import opts
hv.extension('bokeh')

x = np.arange(100)
y = np.random.rand(100)

df = pd.DataFrame({"x": x, "y": y})

curve_opts = hv.opts.Curve(
    title="My title",
    color="red",
    line_width=1.50,
    show_grid=True,
    xrotation=0,
# Play arround with the tools and active_tools lines
    tools=["hover"],
#     tools=["box_zoom", "hover"],
    active_tools=["box_zoom", "wheel_zoom", "hover"],
#     active_tools=["box_zoom", "wheel_zoom", "hover"],
    min_height=225,
    min_width=400,
    responsive=True,
)

hv.Curve(data=df, kdims="x", vdims="y").opts(curve_opts)
@droumis
Copy link
Member

droumis commented Jul 12, 2023

related: #4636

summary: tools adds additional tools while default_tools will replace any default tools. I also don't find this to be intuitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants