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

provide hovermode compare #1731

Open
eromoe opened this issue Aug 20, 2019 · 4 comments
Open

provide hovermode compare #1731

eromoe opened this issue Aug 20, 2019 · 4 comments
Labels
feature something new P3 backlog

Comments

@eromoe
Copy link

eromoe commented Aug 20, 2019

I want hover a position show all data accross vertical line, like :
image

I found javascript version have this plotly/plotly.js#2155 (comment)

But hovermode='compare' got error

ValueError: 
    Invalid value of type 'builtins.str' received for the 'hovermode' property of layout
        Received value: 'compare'

    The 'hovermode' property is an enumeration that may be specified as:
      - One of the following enumeration values:
            ['x', 'y', 'closest', False]

PS: I really think bokeh's hovertool is much better than plotly , at least they put all hover relative things in one place with examples , easy to found what you want, simply add mode='vline' would work

HoverTool(
    tooltips=[
        ( 'date',   '@date{%F}'            ),
        ( 'close',  '$@{adj close}{%0.2f}' ), # use @{ } for field names with spaces
        ( 'volume', '@volume{0.00 a}'      ),
    ],
    formatters={
        'date'      : 'datetime', # use 'datetime' formatter for 'date' field
        'adj close' : 'printf',   # use 'printf' formatter for 'adj close' field
                                  # use default 'numeral' formatter for other fields
    },
    # display a tooltip whenever the cursor is vertically in line with a glyph
    mode='vline
')

plotly document contain many things but didn't group well, find a solution is not easy .

@mogrein
Copy link

mogrein commented Nov 20, 2019

plotly.py provides "x" and "y" instead of "compare", according to axis you need.

@eromoe
Copy link
Author

eromoe commented Nov 20, 2019

@mogrein The key requirement is hover a position show **all data** accross **vertical line**
Just look the plotl js version, it show all data(feature) at one x position(by vertical line) .

For example , default behavious don't show all data around this vertical line :

image

You only can hover show one point (no comparsion to orther features ) , only show green feature below, however there are four different points at here :

image

@efouquet
Copy link

I would also like to be able to use hovermode='compare' as part of the layout specification. Once the plots are actually rendered, clicking on "compare data on hover" in the plotly menu works fine, but there doesn't seem to be any programatic way to have this be the default.

@DradeAW
Copy link

DradeAW commented Nov 29, 2021

Having hovermode="compare" would be really useful in python.
I have multiple subplots with a Scatter plot on each, and when I'm hovering one dot, I'd like it to hover on the other subplots (but the dot doesn't have the same x or y value, it would match by the index in the list).

I don't think it's doable without the "compare" argument.

@gvwilson gvwilson self-assigned this Jun 13, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added the P3 backlog label Aug 12, 2024
@gvwilson gvwilson changed the title hovermode compare doesn't not work hovermode compare does not work Aug 12, 2024
@gvwilson gvwilson changed the title hovermode compare does not work provide hovermode compare Aug 12, 2024
@gvwilson gvwilson added the feature something new label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
Development

No branches or pull requests

5 participants