# Can I change Mapbox color style in Dash?

**URL:** <https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356>\
**Category:** Dash Python\
**Created:** [August 11, 2017, 8:01pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356 "2017-08-11T20:01:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![deejep](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/deejep/32/1554_2.png) [@deejep](https://community.plotly.com/u/deejep)\
**Post date:** [August 11, 2017, 8:01pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/1 "2017-08-11T20:01:11Z")

</div>

Hi,  
All the mapbox examples so far have dark style, can I change its style to white or blue ?  
thanks

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [August 11, 2017, 8:09pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/2 "2017-08-11T20:09:57Z")

</div>

You can - see [https://plot.ly/python/scattermapbox/](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](https://plot.ly/create)

 ![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/8/812709373714c6b77fe6f1b758a5371c759d4f64.png)

---

<div class="post-metadata">

**Author:** ![Krulvis](https://avatars.discourse-cdn.com/v4/letter/k/838e76/32.png) [@Krulvis](https://community.plotly.com/u/Krulvis)\
**Post date:** [January 21, 2019, 1:07pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/3 "2019-01-21T13:07:08Z")

</div>

So you need pro to do this? Or am I missing something? is it possible to load a mapbox style directly?

---

<div class="post-metadata">

**Author:** ![bpwong](https://avatars.discourse-cdn.com/v4/letter/b/c6cbf5/32.png) [@bpwong](https://community.plotly.com/u/bpwong)\
**Post date:** [February 23, 2019, 9:02pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/4 "2019-02-23T21:02:26Z")

</div>

@Krulvis I don’t see that menu option either

![image](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/c/c6a690a298fab2633d3182c5569374bb004be03c.png)

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](https://community.plotly.com/t/custom-mapbox-studio-style-in-dash/10050)  
[Hide specific layer from generic mapbox map](https://community.plotly.com/t/hide-specific-layer-from-generic-mapbox-map/11402)

Maybe it’s linked to plotly in general. I get similar results when I use the `plotly.graph_objs` library.

Any thoughts @chriddyp @bcd?

---

<div class="post-metadata">

**Author:** ![stefan\_gre](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@stefan\_gre](https://community.plotly.com/u/stefan_gre)\
**Post date:** [March 13, 2019, 5:37am UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/5 "2019-03-13T05:37:32Z")

</div>

same here - having custom map styles enabled would be a game changer!

---

<div class="post-metadata">

**Author:** ![srepho](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/srepho/32/6285_2.png) [@srepho](https://community.plotly.com/u/srepho)\
**Post date:** [March 31, 2019, 9:32pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/6 "2019-03-31T21:32:43Z")

</div>

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’  
)

---

<div class="post-metadata">

**Author:** ![ayanke](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ayanke](https://community.plotly.com/u/ayanke)\
**Post date:** [September 19, 2019, 4:50pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/7 "2019-09-19T16:50:40Z")

</div>

> [@srepho](#):
>
> nd 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.

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.

---

<div class="post-metadata">

**Author:** ![nicolaskruchten](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/nicolaskruchten/32/7018_2.png) [@nicolaskruchten](https://community.plotly.com/u/nicolaskruchten)\
**Post date:** [September 20, 2019, 12:41pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/8 "2019-09-20T12:41:06Z")

</div>

Here is the official documentation for Mapbox layers and styles: [https://plot.ly/python/mapbox-layers/#base-maps-in-layoutmapboxstyle](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!

---

<div class="post-metadata">

**Author:** ![nicolaskruchten](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/nicolaskruchten/32/7018_2.png) [@nicolaskruchten](https://community.plotly.com/u/nicolaskruchten)\
**Post date:** [September 20, 2019, 12:42pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/9 "2019-09-20T12:42:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![michaelbabyn](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/michaelbabyn/32/3569_2.png) [@michaelbabyn](https://community.plotly.com/u/michaelbabyn)\
**Post date:** [September 20, 2019, 1:39pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/10 "2019-09-20T13:39:46Z")

</div>

@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)

---

<div class="post-metadata">

**Author:** ![ayanke](https://avatars.discourse-cdn.com/v4/letter/a/45deac/32.png) [@ayanke](https://community.plotly.com/u/ayanke)\
**Post date:** [October 9, 2019, 5:58pm UTC](https://community.plotly.com/t/can-i-change-mapbox-color-style-in-dash/5356/12 "2019-10-09T17:58:46Z")

</div>

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…
