question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Choropleth maps don't reset accurately when layout.geo.scope is changed

See original GitHub issue

First 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
etpinardcommented, May 3, 2019

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

0reactions
etpinardcommented, May 13, 2019

No problem! Thanks for the very clear bug report!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plotly Choropleth Map not plotting - python - Stack Overflow
I'm not sure what the data format is, but it must be a state code to be specified in the Locations. The code...
Read more >
Map configuration and styling in Python - Plotly
Over 11 examples of Map Configuration and Styling including changing color, size, log axes, and more in Python.
Read more >
Complexity reduction in choropleth map animations by ...
Although animation congruently depicts change, the rapid succession of complex map scenes easily exceeds the human cognitive capacity, ...
Read more >
Choropleth Maps in Geography
A choropleth map is appropriate when presenting data for geographical areas and regions. ... It is clear that the map does not show...
Read more >
General Issues - | Natural Resources Conservation Service
Soil Survey Geographic Database (SSURGO) documentation including table names, ... Soil Map or Soil Data Explorer tabs and start getting soil information.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found