Bar plot hover shows incorrect bar length when base is used
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
Hello,
I tried making something like a Gantt chart and use the Bar plot type for that. It seems the hover effect is mixing up the columns somehow. Here is a minimal reproduction:
import pandas as pd
import plotly.express as px
gantt = []
gantt.append(dict(Begin=0, End=1, Word='Foo'))
gantt.append(dict(Begin=2, End=5, Word='Bar'))
gantt_df = pd.DataFrame(gantt)
gantt_df['Duration'] = (gantt_df['End'] - gantt_df['Begin'])
fig = px.bar(gantt_df, base="Begin", y="Duration", x="Word")
fig.show()
Here is the result:
Things of note:
- The position and size of the bars is correct
- The "Begin" annotation in the hover is correct
- The "Duration" annotation shows the value of the "End" column, which is not correct. I would expect "End=5" or "Duration=3" but not "Duration=5"
Examining the pandas dataframe itself shows that the data itself is correct:
This is my version according to conda:
plotly 5.23.0 pyhd8ed1ab_0 conda-forge
Thank you for providing this great library for free and I hope that you find my report helpful.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie damit, die minimale pandas- und plotly.express-Reproduktion aus dem Issue mit plotly 5.23.0 auszuführen, und vergleichen Sie die gerenderten Hover-Felder des Balkens mit Begin, End und Duration im dataframe. Die Arbeit ist abgeschlossen, wenn die Positionen der Balken korrekt bleiben und der Hover den erwarteten Duration-Wert anstelle von End anzeigt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- pandas, python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100