You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Stamen Terrain base map (Stadia Maps token needed): density heatmap with `plotly.express`
56
-
57
-
Some base maps require a token. To use "stamen" base maps, you'll need a [Stadia Maps](https://www.stadiamaps.com) token, which you can provide to the `mapbox_accesstoken` parameter on `fig.update_layout`. Here, we have the token saved in a file called `.mapbox_token`, load it in to the variable `token`, and then pass it to `mapbox_accesstoken`.
58
-
59
-
```python
60
-
import plotly.express as px
61
-
import pandas as pd
62
-
63
-
token =open(".mapbox_token").read() # you will need your own token
If Plotly Express does not provide a good starting point, it is also possible to use [the more generic `go.Densitymap` class from `plotly.graph_objects`](/python/graph-objects/).
@@ -90,49 +68,52 @@ fig.show()
90
68
```
91
69
92
70
<!-- #region -->
93
-
### Stamen Terrain base map (Stadia Maps token needed): density heatmap with `plotly.graph_objects`
71
+
### Mapbox Maps
94
72
95
-
Some base maps require a token. To use "stamen" base maps, you'll need a [Stadia Maps](https://www.stadiamaps.com) token, which you can provide to the `mapbox_accesstoken` parameter on `fig.update_layout`. Here, we have the token saved in a file called `.mapbox_token`, load it in to the variable `token`, and then pass it to `mapbox_accesstoken`.
73
+
The earlier examples using `px.density_mapbox` and `go.Densitymap` use Maplibre for rendering. These traces were introduced in Plotly.py 5.24. These trace types are now the recommended way to make tile-based density heatmaps. There are also traces that use Mapbox: `density_mapbox` and `go.Densitymapbox`.
74
+
75
+
To use these trace types, in some cases you _may_ need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information.
96
76
77
+
Here's one of the earlier examples rewritten to use `px.density_mapbox`.
The earlier examples using `px.density_mapbox` and `go.Densitymap` use Maplibre for rendering. These traces were introduced in Plotly.py 5.24. These trace types are now the recommended way to make tile-based density heatmaps. There are also traces that use Mapbox: `density_mapbox` and `go.Densitymapbox`.
118
-
119
-
To use these trace types, in some cases you _may_ need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information.
93
+
<!-- #region -->
94
+
#### Stamen Terrain base map (Stadia Maps token needed): density heatmap with `plotly.express`
120
95
121
-
Here's one of the earlier examples rewritten to use `px.density_mapbox`.
96
+
Some base maps require a token. To use "stamen" base maps, you'll need a [Stadia Maps](https://www.stadiamaps.com) token, which you can provide to the `mapbox_accesstoken` parameter on `fig.update_layout`. Here, we have the token saved in a file called `.mapbox_token`, load it in to the variable `token`, and then pass it to `mapbox_accesstoken`.
122
97
123
98
```python
99
+
import plotly.express as px
124
100
import pandas as pd
101
+
102
+
token =open(".mapbox_token").read() # you will need your own token
See [function reference for `px.(density_map)`](https://plotly.com/python-api-reference/generated/plotly.express.density_mapbox) or https://plotly.com/python/reference/densitymap/ for available attribute options.
Copy file name to clipboardExpand all lines: doc/python/mapbox-layers.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -204,7 +204,7 @@ fig.show()
204
204
<!-- #region -->
205
205
#### Stamen Watercolor using a Custom Style URL
206
206
207
-
Here's an example of using a custom style URL that points to the Stadia Maps service to use the `stamen_watercolor` base map.
207
+
Here's an example of using a custom style URL that points to the [Stadia Maps](https://docs.stadiamaps.com/map-styles/stamen-watercolor) service to use the `stamen_watercolor` base map.
0 commit comments