plotly / plotly/plotly.py

Customize Boxplot hoverinfo

Offen
#3,334 2 Kommentare 6 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature P3
Vorherrschende Sprache
Python
Sterne
18.8k
Forks
2.8k
Ø Merge
16 Std. 26 Min.
Gemergte PRs (30 T.)
21

Beschreibung

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 :)

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, das bereitgestellte Python-Beispiel mit go.Box, customdata und hovertemplate zu reproduzieren. Lies das Hover-Verhalten von boxplot und ermittle, wie benutzerdefinierte Werte die Beschriftung der x-Achse ersetzen können, während die Informationen zu q1, q3 und mean erhalten bleiben. Erledigt ist die Aufgabe, wenn das Beispiel im Hover-Text 0 für Tag 1 und 1 für Tag 2 anzeigt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
data-visualization
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.