plotly / plotly/plotly.py

provide hovermode compare

Open
#1,731 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

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

I found javascript version have this https://github.com/plotly/plotly.js/issues/2155#issuecomment-351393616

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 .

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Compare the plotly.js behavior referenced in issue #2155 with plotly.py's accepted layout hovermode values, starting at the validation that currently rejects 'compare'. Confirm the desired vertical hover behavior across traces and verify that the supported value produces the requested display.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.