Choropleth maps don't reset accurately when layout.geo.scope is changed
See original GitHub issueFirst and foremost, I thought I would mention that this issue is only occurring with Plotly.react
as I was able to implement a correct alternative by using Plotly.newPlot
but unfortunately means that I won’t be able to use react-plotly for this component.
With that out of the way, the bug occurs when the layout scope is changed and either 1. a double click event is triggered or 2. reset is pressed in the mode bar. When the plot is changed through the dropdown though, there is no issue. All examples below can be reproduced in this code pen.
In cases where scope is not ‘usa’, the reset changed the lon/lat values to whatever the initial plot’s geo scope was set at. This is very pronounced when switching from ‘world’ to ‘north america’, thus I chose that for the example, but this occurs in any situation. If the initial plot is set to ‘north america’, then it would be the reverse.
In cases where the plot is changed to ‘usa’ though, the js actually throws an error! The error is:
TypeError: centerPx is null
.
So this is actually two errors, but they both seem to have the same root cause.
Let me know if I can provide any more clarity.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Thanks very much for the report!
Something must be up with
https://github.com/plotly/plotly.js/blob/03b7e09fa4fc6c842a28d8ba02547658cd43b6fe/src/plots/geo/geo.js#L515-L540
where we should probably clear the thing on update call involving
geo.scope
No problem! Thanks for the very clear bug report!