plotly / plotly.py

The interactive graphing library for Python :sparkles: This project now includes Plotly Express!
https://plotly.com/python/
MIT License
16.26k stars 2.55k forks source link

Malaysia is shown in a wrong place on a map #2810

Open chernyshevdv opened 4 years ago

chernyshevdv commented 4 years ago

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.

Shwetago commented 4 years ago

What is df_merged here?

chernyshevdv commented 4 years ago

What is df_merged here?

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

+---------------+---------+
|  alpha_3      | devices |
+---------------+---------+
|  MYS          |       2 |
+---------------+---------+
|  ROU          |       4 |
+---------------+---------+
Shwetago commented 4 years ago

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

chernyshevdv commented 4 years ago

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

gvwilson commented 2 months ago

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

archmoj commented 2 months ago

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