I’m a little confused by the behavior of
plotly.express.histogram. Especially when coloring by a column. It seems as if the size of the bars doesn’t actually match the Y-axis in some cases. In the first picture below, the blue histogram has a higher value for that bin than the red one but it’s showed above the red one and it’s value doesn’t match the Y-axis. On the second picture the bin of the blue histogram is correctly positioned above the red one. However, its value doesn’t “match” the Y-axis. The code to reproduce the plot is posted at the end.
import plotly.express as px election = px.data.election() fig = px.histogram(election, color="result", x="total", histnorm="probability density", width=8 * 100, height=5 * 100) fig.show()
Plotly version 4.8.0, Operative system: Manjaro bspwm