You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bin size becomes 1 (very thin) when data changes with barmode: 'overlay' for histogram #7506
When the histogram data changes (mutates) and layout.barmode is set to 'overlay', the bin size resets to 1.
This happens in two cases:
Switching from linear (numeric) values to category values, then back to linear.
Before:
linear (numeric):
category values (after changing data):
After:
linear (numeric) (after changing back):
Switching from linear (numeric) values to linear (numeric), then back to original data.
Before:
linear (numeric):
linear (numeric) (after changing data):
After:
linear (numeric) (after changing back):
You can clearly see the bins become extremely thin after the data update, but only when barmode: 'overlay' is used.
Expected behavior
Bin sizes should remain consistent or auto-adjust correctly when data changes, not reset to 1, which makes the bins extremely thin.
Why this is important
For react-plotly and other reactive setups, data changes are very common. This bug makes histogram rendering unreliable when using 'overlay', which is often needed for comparing multiple datasets. It is a critical issue for apps that frequently re-render histograms with updated data.
This problem seems to exist for many years. I've seen similar issues reported a long time ago.
This issue may just be a side effect of Plotly.react (see #2389) that happens to be visible in this case. Here, I'm only focusing on the resulting bin size issue.
Activity
Lexachoc commentedon Aug 3, 2025
After applying #7507
Now the bin sizes are correct after data changes.
Recording from test dashboard
Change data (linear↔category)
Change data (linear↔linear)
Even with user defined xbins.size, e.g., size=10 for the initial numerical data↔category
Even with user defined xbins.size, e.g., size=10 for the initial numerical data↔ new numerical data with size = 50