-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k

Description
I believe I have found an issue with plotly express which is visible even on the tutorial page. Namely when drawing a histogram with plotly express and using color
argument to group data, the size of count bars is bigger than the real count value.
Code from tutorials can be used as a reproducible example (section: Visualizing the distribution):
https://plotly.com/python/histograms/ Count bars for Male
group are bigger than actual counts displayed when we hover over the bar. E. g. for total_bill = 16 - 17.99
we have count = 18
in the annotation, but the value displayed is greater than 30. I've manually checked a few values for various plots and the true value is correctly displayed in the annotation. The count bars are however much bigger than they should.
For completeness, here's the code which is being used in the tutorial:
import plotly.express as px
df = px.data.tips()
fig = px.histogram(df, x="total_bill", color="sex", marginal="rug", # can be `box`, `violin`
hover_data=df.columns)
fig.show()