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

Customize Boxplot hoverinfo

Open jwiemer112 opened this issue 3 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