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
Copy file name to clipboardExpand all lines: doc/python/filled-area-on-mapbox.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -137,7 +137,7 @@ fig.show()
137
137
<!-- #region -->
138
138
### Mapbox Maps
139
139
140
-
The earlier examples using `go.Scattermap` use Maplibre for rendering. These traces were introduced in Plotly.py 5.24. This trace types is now the recommended way to draw filled areas on tile-based maps. There is also a trace that uses Mapbox, called `go.Scattermapbox`.
140
+
The earlier examples using `go.Scattermap` use Maplibre for rendering. These traces were introduced in Plotly.py 5.24. This trace type is now the recommended way to draw filled areas on tile-based maps. There is also a trace that uses Mapbox, called `go.Scattermapbox`.
141
141
142
142
To use the `Scattermapbox` trace type, 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.
Copy file name to clipboardExpand all lines: doc/python/mapbox-density-heatmaps.md
+45-24Lines changed: 45 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ jupyter:
6
6
extension: .md
7
7
format_name: markdown
8
8
format_version: '1.3'
9
-
jupytext_version: 1.14.6
9
+
jupytext_version: 1.16.3
10
10
kernelspec:
11
11
display_name: Python 3 (ipykernel)
12
12
language: python
@@ -20,42 +20,39 @@ jupyter:
20
20
name: python
21
21
nbconvert_exporter: python
22
22
pygments_lexer: ipython3
23
-
version: 3.10.11
23
+
version: 3.10.0
24
24
plotly:
25
-
description: How to make a Mapbox Density Heatmap in Python with Plotly.
25
+
description: How to make a density heatmap in Python with Plotly.
26
26
display_as: maps
27
27
language: python
28
28
layout: base
29
-
name: Mapbox Density Heatmap
29
+
name: Density Heatmap
30
30
order: 5
31
31
page_type: u-guide
32
-
permalink: python/mapbox-density-heatmaps/
32
+
permalink: python/density-heatmaps/
33
33
thumbnail: thumbnail/mapbox-density.png
34
+
redirect_from: python/mapbox-density-heatmaps/
34
35
---
35
36
36
-
#### Mapbox Access Token
37
-
38
-
To plot on Mapbox maps with Plotly, you may need a [Mapbox account and token](https://www.mapbox.com/studio) or a [Stadia Maps account and token](https://www.stadiamaps.com), depending on base map (`mapbox_style`) you use. On this page, we show how to use the "open-street-map" base map, which doesn't require a token, and a "stamen" base map, which requires a Stadia Maps token. See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more examples.
39
-
40
-
### OpenStreetMap base map (no token needed): density mapbox with `plotly.express`
37
+
### Density map with `plotly.express`
41
38
42
39
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on a variety of types of data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
43
40
44
-
With `px.density_mapbox`, each row of the DataFrame is represented as a point smoothed with a given radius of influence.
41
+
With `px.density_map`, each row of the DataFrame is represented as a point smoothed with a given radius of influence.
### Stamen Terrain base map (Stadia Maps token needed): density mapbox with `plotly.express`
55
+
### Stamen Terrain base map (Stadia Maps token needed): density heatmap with `plotly.express`
59
56
60
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`.
61
58
@@ -67,33 +64,33 @@ token = open(".mapbox_token").read() # you will need your own token
### OpenStreetMap base map (no token needed): density mapbox with `plotly.graph_objects`
76
+
### Density map with `plotly.graph_objects`
80
77
81
-
If Plotly Express does not provide a good starting point, it is also possible to use [the more generic `go.Densitymapbox` class from `plotly.graph_objects`](/python/graph-objects/).
78
+
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/).
### Stamen Terrain base map (Stadia Maps token needed): density mapbox with `plotly.graph_objects`
93
+
### Stamen Terrain base map (Stadia Maps token needed): density heatmap with `plotly.graph_objects`
97
94
98
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`.
99
96
@@ -106,14 +103,38 @@ token = open(".mapbox_token").read() # you will need your own token
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.
120
+
121
+
Here's one of the earlier examples rewritten to use `px.density_mapbox`.
See [function reference for `px.(density_mapbox)`](https://plotly.com/python-api-reference/generated/plotly.express.density_mapbox) or https://plotly.com/python/reference/densitymapbox/ for more information about mapbox and their attribute options.
138
+
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.
139
+
140
+
For Mapbox-based maps, see [function reference for `px.(density_mapbox)`](https://plotly.com/python-api-reference/generated/plotly.express.density_mapbox) or https://plotly.com/python/reference/densitymapbox/.
0 commit comments