## Reproducible example Demo: https://codepen.io/Lexachoc/pen/KwdWZGv ## The problem When the histogram data changes (mutates) and `layout.barmode` is set to `'overlay'`, the bin size resets to 1. This happens in two cases: 1. Switching from linear (numeric) values to category values, then back to linear. Before: linear (numeric): <img width="1507" height="381" alt="Image" src="https://github.com/user-attachments/assets/14b11b6d-c414-4f1c-8e7d-368550443f41" /> category values (after changing data): <img width="1507" height="381" alt="Image" src="https://github.com/user-attachments/assets/4f20d709-bc37-441e-a790-d3dfb9bf67c4" /> After: linear (numeric) (after changing back): <img width="1507" height="381" alt="Image" src="https://github.com/user-attachments/assets/5b315474-1fe6-47e8-aa0c-152e22030dc6" /> 2. Switching from linear (numeric) values to linear (numeric), then back to original data. Before: linear (numeric): <img width="1507" height="381" alt="Image" src="https://github.com/user-attachments/assets/14b11b6d-c414-4f1c-8e7d-368550443f41" /> linear (numeric) (after changing data): <img width="1507" height="381" alt="Image" src="https://github.com/user-attachments/assets/8d2d1298-d3d5-4633-b607-520d89f12f09" /> After: linear (numeric) (after changing back): <img width="1507" height="381" alt="Image" src="https://github.com/user-attachments/assets/0571cf23-bf5d-474e-b5f2-d1fd467211d5" /> 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. ## Relevent issue #2389 ## Note 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.