Closed shawnrosofsky closed 8 months ago
Stamen switched to a paid model under Stadia Maps. This is addressed in plotly.js v2.27.1 which we will incorporate in a new plotly.py release shortly.
This was included in the latest Plotly.py release, 5.19. The docs show examples of using a token for the stamen styles https://plotly.com/python/mapbox-density-heatmaps/#stamen-terrain-base-map-stadia-maps-token-needed-density-mapbox-with-plotlyexpress
I made my token, cut-and-pasted the example from the link Liam provided above into a Jupyter notebook, and it still doesn't work. The data is plotting fine but the background is missing.
I made my token, cut-and-pasted the example from the link Liam provided above into a Jupyter notebook, and it still doesn't work. The data is plotting fine but the background is missing.
I'm experiencing the same issue. The data gets plotted but the map background is empty. I'm using Plotly 5.20.0
This actually works for me @tuopouk @rmthomps .
I used my own mapbox token in this code and I got the background to display fine. I'm using Plotly 5.20.0 and the Firefox browser.
import plotly.graph_objects as go
import pandas as pd
token = 'my-token'
quakes = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/earthquakes-23k.csv')
fig = go.Figure(go.Densitymapbox(lat=quakes.Latitude, lon=quakes.Longitude, z=quakes.Magnitude,
radius=10))
fig.update_layout(mapbox_style="stamen-terrain", mapbox_center_lon=180, mapbox_accesstoken=token)
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
For me with that exact code this kind of map gets generated. The result is the same whether it's a mapbox token or a stadia token.
I also tried other stamen types (stamen-watercolor and stamen-toner) but with the same result as above. I tried the rendering in VS Code and exported it to html to open it with Firefox but the background seems to be lacking still. @Coding-with-Adam Did you get the map background rendered.
For instance the open-street-map renders correctly with both tokens
hi @tuopouk I'm not sure what's the difference, why it's not rendering for you. Yes, I was able to get the map background rendered.
hi @tuopouk I'm not sure what's the difference, why it's not rendering for you. Yes, I was able to get the map background rendered.
@Coding-with-Adam Did you use the general default token or a custom token?
I used a custom token. You?
@Coding-with-Adam I think that what you call a general token is a mapbox token, while a custom one is got from stadiamaps.com. Isn't it?
Hello, I'm also having this problem, using plotly version 5.20. When using the follow code I get a map with no background.
stadio_token = 'my_stadiamaps_token'
fig = px.scatter_mapbox(df,
lat='lat',
lon='long,
color='categorical_chain_name',
center=dict(lat=51.44, lon=7.35),
zoom=12,
hover_name='categorical_chain_name'
)
fig.update_layout(mapbox_style="stamen-terrain", mapbox_accesstoken=stadia_token)
fig.update_layout(legend = dict(bordercolor='rgb(100,100,100)',
borderwidth=2,
itemclick= 'toggleothers',
font = dict(family = "Courier", size = 20, color = "black"),
x=0.75,
y=0.75))
fig.show()
fig.write_html(out.html')
I have also tried using px.set_mapbox_access_token(stadia_token)
, with no change. I couldnt find the equivalent method for Stadiamaps.
incidentally, there are also no credits being removed from my Stadiamaps quota.
This isn't working for me as well. Tried several options without success. Stadia Maps don't appear to be working.
It appears that the stamen styles (stamen-terrain, stamen-toner, stamen-watercolor) no longer work on mapbox maps. Using one of these styles, just gives a blank map under the data provided to the plotting function. I could provide an example of trying this myself, but it appears that the example pages using this style also have this problem such as https://plotly.com/python/mapbox-density-heatmaps/.
Is this a bug or is there some issue with mapbox no longer supporting stamen styles?