plotly.py
plotly.py copied to clipboard
plotly.express.scatter_geo() function cannot generate world map
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.
Troubleshooting that has already been done
- Tried to switch browser to FireFox. The same.
- Changing the template to
template="seaborn"
. Didn't work. - Tried checking console. No JavaScript Errors.
cdn.plot.ly
is reachable.
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
- Checked
chrome://gpu
. WebGL(2) is already enabled. - 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. - 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.
- 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!
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
Hi - we are tidying up stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. If you'd like to submit a PR, we'd be happy to prioritize a review, and if it's a request for tech support, please post in our community forum. Thank you - @gvwilson