plotly.py icon indicating copy to clipboard operation
plotly.py copied to clipboard

Malaysia is shown in a wrong place on a map

Open chernyshevdv opened this issue 5 years ago • 6 comments
trafficstars

I am visualizing some data with plotly.express.scatter_geo. Malaysian data is shown in a wrong place: image Actually, Malaysia resides on both islands: image ...but the capital Kuala Lumpur is situated in north-western part, and this part is associated with MY on maps by people. Code is the following:

import nbformat
import plotly.express as px
import pandas as pd

...
fig = px.scatter_geo(df_merged, locations="alpha_3", size="devices", hover_name="country")
print(fig.to_html())

Package version is plotly==4.11.0. JSON map is world_110m.json.

chernyshevdv avatar Oct 07 '20 05:10 chernyshevdv

What is df_merged here?

Shwetago avatar Oct 09 '20 04:10 Shwetago

What is df_merged here?

df_merged is a pandas DataFrame containing data similar to the following:

+---------------+---------+
|  alpha_3      | devices |
+---------------+---------+
|  MYS          |       2 |
+---------------+---------+
|  ROU          |       4 |
+---------------+---------+

chernyshevdv avatar Oct 09 '20 09:10 chernyshevdv

I think this is because of the values in the dataset that you are using. Your source code is correct!

Shwetago avatar Oct 09 '20 12:10 Shwetago

I know that my source code is correct :-) I believe that the library is showing Malaysia at a slightly wrong place.

chernyshevdv avatar Oct 09 '20 12:10 chernyshevdv

@archmoj can you please check this against your recent work and see if it's still an issue?

gvwilson avatar Aug 12 '24 15:08 gvwilson

This is also related to geo subplots not map & mapbox. @ndrezn Please keep track of this ticket.

archmoj avatar Aug 12 '24 15:08 archmoj

Closing in favor of https://github.com/plotly/plotly.js/issues/7334

ndrezn avatar Feb 11 '25 16:02 ndrezn