plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Customize Boxplot hoverinfo

Open jwiemer112 opened this issue 4 years ago • 2 comments

Is it possible to customize the hoverinfo of boxplots? Instead of showing the x-axis value infront of q1, q3, mean, etc..I want to change the value for the 'x-axis on the hover info. I thougt that this is possible with customdata but if I use it only the standard informations are displayed.


import plotly.graph_objects as go

x = ['day 1', 'day 1', 'day 1', 'day 1', 'day 1', 'day 1',
     'day 2', 'day 2', 'day 2', 'day 2', 'day 2', 'day 2']

fig = go.Figure()
meta=[0,1,2,3]
fig.add_trace(go.Box(
    y=[0.2, 0.2, 0.6, 1.0, 0.5, 0.4, 0.2, 0.7, 0.9, 0.1, 0.5, 0.3],
    x=x,
    name='kale',
    marker_color='#3D9970',
    customdata=[0, 0, 0 ,0 ,0 ,0, 1, 1, 1, 1, 1, 1],
    hovertemplate='x:%{customdata}'
))

fig.show(renderer='browser')

I want that in the hovrinfo it says 0 insead of 'day 1' and 1 instead of 'day 2' for example.

Greetz Jan :)

jwiemer112 avatar Aug 05 '21 08:08 jwiemer112

Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for several years, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Thanks for your help - @gvwilson

gvwilson avatar Jun 25 '24 20:06 gvwilson

Hello @gvwilson, I just checked my code snippet, and the issue still exists. I recommend to reopen the issue.

Greetz Jan :)

jwiemer112 avatar Jun 26 '24 06:06 jwiemer112