Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotly.express.scatter_geo() function cannot generate world map #4574

Open
xyzzklk opened this issue Apr 17, 2024 · 1 comment
Open

plotly.express.scatter_geo() function cannot generate world map #4574

xyzzklk opened this issue Apr 17, 2024 · 1 comment

Comments

@xyzzklk
Copy link

xyzzklk commented Apr 17, 2024

Metadata

OS: Ubuntu 23
Python version: 3.11.6
Browser: Google Chrome

What I'm trying to do

I'm new to plotly. I'm trying to use the following code to generate a simple world map with some points scattered on it.

import plotly.express as px

lons = [-150.7585, -153.4716, -148.7531, -159.6267, -155.248336791992]
lats = [61.7591, 59.3152, 63.1633, 54.5612, 18.7551670074463]

fig = px.scatter_geo(lat=lats, lon=lons, title="Mark some random points on the world")
fig.show()

Expected behaviour

Plotly opens a new tab in the browser that displays the plot.

Actual behaviour

It displays something like this, which is the grid-like background when creating other figures such as a barchart.
image

Troubleshooting that has already been done

  1. Tried to switch browser to FireFox. The same.
  2. Changing the template to template="seaborn". Didn't work.
  3. Tried checking console. No JavaScript Errors. cdn.plot.ly is reachable.
    image
ping cdn.plot.ly
PING osff.map.fastly.net (151.101.2.217) 56(84) bytes of data.
64 bytes from 151.101.2.217 (151.101.2.217): icmp_seq=1 ttl=57 time=52.2 ms
64 bytes from 151.101.2.217 (151.101.2.217): icmp_seq=2 ttl=57 time=31.9 ms
64 bytes from 151.101.2.217 (151.101.2.217): icmp_seq=3 ttl=57 time=589 ms
64 bytes from 151.101.2.217 (151.101.2.217): icmp_seq=4 ttl=57 time=34.9 ms
^C
--- osff.map.fastly.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 31.903/176.875/588.572/237.819 ms
  1. Checked chrome://gpu. WebGL(2) is already enabled.
  2. Tried other codes, including the sample code in the docs (https://plotly.com/python/scatter-plots-on-maps/#geographical-scatter-plot-with-pxscattergeo). Results in the same display.
  3. I tested my simple piece of code on Windows 11 in both Chrome and Edge. Works well (displays a world map plot). But it just doesn't work on my Ubuntu desktop.
  4. Tried clearing browser cache. Doesn't work.

I'm completely new to plotly, and I don't know how to debug. Please help me! Many thanks!

@michaelbabyn
Copy link
Contributor

Hi @xyzzklk , I don't have any issues running that code on ubuntu 22.04/python 3.11.6/chrome in a fresh conda env. I wonder if you're using an old version of jupyter that doesn't support the new versions of plotly? If you just install new versions of both they should be compatible though:

conda create -n p311 python=3.11.6
pip install plotly jupyter pandas
jupyter notebook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants