Hi,
All the mapbox examples so far have dark style, can I change its style to white or blue ?
thanks
You can - see https://plot.ly/python/scattermapbox/. In particular, then style
attribute inside mapbox
inside layout
can be 'light'
, 'basic'
, 'outdoors'
, 'satellite'
, or 'satellite-streets'
. You can play around with the style of the map in the chart editor GUI at https://plot.ly/create
So you need pro to do this? Or am I missing something? is it possible to load a mapbox style directly?
@Krulvis I donât see that menu option either
Loading the default styles externally seems to work,
style = âmapbox://styles/mapbox/light-v9â
style = âmapbox://styles/mapbox/dark-v9â
But if I try loading my own custom mapbox style, the tiles wonât load.
It appears a few other have had this challenge too
Custom Mapbox Studio style in Dash
Hide specific layer from generic mapbox map
Maybe itâs linked to plotly in general. I get similar results when I use the plotly.graph_objs
library.
same here - having custom map styles enabled would be a game changer!
One way around this is to create your own style in mapbox and call it from dash. For example I created my own style and just called it to dash.
mapbox = dict(
accesstoken = mapbox_access_token,
style = âmapbox://styles/srepho/cjttho6dl0hl91fmzwyicqkzfâ
)
All due respectâŚIâve tried your style and many others, and no styles other than the defaults (e.g., light, dark, etc.) load. Plotly needs to update their documentation saying that Scattermapbox does not currently take custom style urls.
Here is the official documentation for Mapbox layers and styles: https://plot.ly/python/mapbox-layers/#base-maps-in-layoutmapboxstyle (accurate as of plotly
4.1.1!) These docs apply whenever you are using scattermapbox
, choroplethmapbox
or densitymapbox
traces.
In there youâll find information about the various built-in styles and the conditions under which you do or donât require a Mapbox server token
Iâm happy to help interpret and upgrade these docs as required!
Regarding âcustom style URLsâ: these are supported, but I believe they are token-specific, meaning you have to create your own style linked to your own tokens.
@ayanke, there was a bug in plotly mapbox traces that prevented custom styles from loading that was introduced in 1.49.0 of plotly.js and fixed in 1.49.4. This affects plotly.py 4.1.0 and Dash versions 1.1.0 and 1.1.1.
Can you verify that you are not using any of the versions I mentioned above? (you can use pip list
or conda list
to show what packages you have installed)
Yes, that did it Michael. I searched a fair amount for a solution, but this thread is the only one I have found so far that explicitly mentions a fixâŚeven if it means a simple update to plotly haha. Thank you very much! I wish more of my problems could be solved that wayâŚ