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
@@ -37,20 +28,13 @@ We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-docume
37
28
38
29
Version 4 of Plotly's R package is now [available](https://plot.ly/r/getting-started/#installation)!<br>
39
30
Check out [this post](http://moderndata.plot.ly/upgrading-to-plotly-4-0-and-above/) for more information on breaking changes and new features available in this version.
40
-
```{r}
41
-
library(plotly)
42
-
packageVersion('plotly')
43
-
```
44
-
45
-
### Mapbox Access Token
46
-
47
-
To create mapbox maps with Plotly, you'll need a Mapbox account and a [Mapbox Access Token](https://www.mapbox.com/studio/) that you can add to your [Plotly Settings](https://plot.ly/settings/mapbox). If you're using a Chart Studio Enterprise server, please see additional instructions here: https://help.plot.ly/mapbox-atlas/.
To create mapbox maps with Plotly, you'll need a Mapbox account and a [Mapbox Access Token](https://www.mapbox.com/studio/) that you can add to your [Plotly Settings](https://plot.ly/settings/mapbox). If you're using a Chart Studio Enterprise server, please see additional instructions here: https://help.plot.ly/mapbox-atlas/.
47
-
48
35
### Creating Polygon Boundaries
49
36
50
37
```{r}
@@ -147,16 +134,6 @@ p
147
134
```
148
135
149
136
### Add Polygon to Mapbox
150
-
151
-
To create mapbox maps with Plotly, you'll need a Mapbox account and a [Mapbox Access Token](https://www.mapbox.com/studio/) that you can add to your [Plotly Settings](https://plot.ly/settings/mapbox).
To plot on Mapbox maps with Plotly you `may` need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio), that you can add to your [Plotly Settings](https://plot.ly/settings/mapbox). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information. If you're using a Chart Studio Enterprise server, please see additional instructions [here](https://help.plot.ly/mapbox-atlas).
48
-
49
36
### How to Show an Area on a Map
50
37
51
38
There are three different ways to show an area in a mapbox:
Copy file name to clipboardExpand all lines: r/2019-09-20-mapbox-layers.Rmd
+21-37Lines changed: 21 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -33,24 +33,6 @@ library(plotly)
33
33
packageVersion('plotly')
34
34
```
35
35
36
-
### Mapbox Access Token
37
-
38
-
To create mapbox maps with Plotly, you'll need a Mapbox account and a [Mapbox Access Token](https://www.mapbox.com/studio/) that you can add to your [Plotly Settings](https://plot.ly/settings/mapbox). If you're using a Chart Studio Enterprise server, please see additional instructions here: https://help.plot.ly/mapbox-atlas/.
If your figure contains one or more traces of type `Scattermapbox`, `Choroplethmapbox` or `Densitymapbox`, the `layout` object in your figure contains configuration information for the map itself. The map is composed of various layers, of three different types.
<li> `layout.mapbox.layers` is an array that defines more layers that are by default rendered above the traces in `data` (although this can also be controlled via the `below` attribute).</li>
61
43
</ol>
62
44
63
-
64
-
### Mapbox Access Tokens and When You Need Them
65
-
66
-
The word "mapbox" in the trace names and `layout.mapbox` refers to the Mapbox.js open-source library. If your basemap in `layout.mapbox.style` uses data from the Mapbox *service*, then you will need to register for a free account at https://mapbox.com/ and obtain a Mapbox Access token. This token should be provided either in `mapboxAccessToken` in `setPlotConfig` function, or as a variable that would be passed as an argument of `newPlot`.
67
-
If your `layout.mapbox.style` does not use data from the Mapbox service, you do *not* need to register for a Mapbox account.
68
-
<h6>Base Maps in `layout.mapbox.style`</h6>
69
-
The accepted values for `layout.mapbox.style` are one of the following tiles.
70
-
<ol>
71
-
<li> `"white-bg"` yields an empty white canvas which results in no external HTTP requests </li>
72
-
<li> `"open-street-map"`, `"carto-positron"`, `"carto-darkmatter"`, `"stamen-terrain"`, `"stamen-toner"` or `"stamen-watercolor"` yeild maps composed of *raster* tiles from various public tile servers which do not require signups or access tokens </li>
73
-
<li> `"basic"`, `"streets"`, `"outdoors"`, `"light"`, `"dark"`, `"satellite"`, or `"satellite-streets"` yeild maps composed of *vector* tiles from the Mapbox service, and *do* require a Mapbox Access Token or an on-premise Mapbox installation. </li>
74
-
<li> A Mapbox service style URL, which requires a Mapbox Access Token or an on-premise Mapbox installation. </li>
75
-
<li> A Mapbox Style object as defined at https://docs.mapbox.com/mapbox-gl-js/style-spec/ </li>
76
-
</ol>
77
-
78
45
### OpenStreetMap Tiles, no Token Needed
79
46
80
47
Here is a simple map rendered with "open-street-map" tiles, without needing a Mapbox Access Token.
@@ -95,7 +62,7 @@ p <- us_cities %>%
95
62
mapbox = list(
96
63
style = 'open-street-map',
97
64
zoom =2.5,
98
-
center = list(lon = -88, lat = 34)))
65
+
center = list(lon = -88, lat = 34)))
99
66
100
67
p
101
68
```
@@ -164,14 +131,31 @@ p <- us_cities %>%
164
131
p
165
132
```
166
133
134
+
### Mapbox Access Tokens and When You Need Them
135
+
136
+
The word "mapbox" in the trace names and `layout.mapbox` refers to the Mapbox.js open-source library. If your basemap in `layout.mapbox.style` uses data from the Mapbox *service*, then you will need to register for a free account at https://mapbox.com/ and obtain a Mapbox Access token. This token should be provided either in `mapboxAccessToken` in `setPlotConfig` function, or as a variable that would be passed as an argument of `newPlot`.
137
+
If your `layout.mapbox.style` does not use data from the Mapbox service, you do *not* need to register for a Mapbox account.
138
+
<h6>Base Maps in `layout.mapbox.style`</h6>
139
+
The accepted values for `layout.mapbox.style` are one of the following tiles.
140
+
<ol>
141
+
<li> `"white-bg"` yields an empty white canvas which results in no external HTTP requests </li>
142
+
<li> `"open-street-map"`, `"carto-positron"`, `"carto-darkmatter"`, `"stamen-terrain"`, `"stamen-toner"` or `"stamen-watercolor"` yeild maps composed of *raster* tiles from various public tile servers which do not require signups or access tokens </li>
143
+
<li> `"basic"`, `"streets"`, `"outdoors"`, `"light"`, `"dark"`, `"satellite"`, or `"satellite-streets"` yeild maps composed of *vector* tiles from the Mapbox service, and *do* require a Mapbox Access Token or an on-premise Mapbox installation. </li>
144
+
<li> A Mapbox service style URL, which requires a Mapbox Access Token or an on-premise Mapbox installation. </li>
145
+
<li> A Mapbox Style object as defined at https://docs.mapbox.com/mapbox-gl-js/style-spec/ </li>
146
+
</ol>
147
+
167
148
#### Dark Tiles from Mapbox Service: Free Token Needed
168
149
169
150
Here is a map rendered with the `"dark"` style from the Mapbox service, which requires an Access Token:
170
151
171
152
```{r}
172
153
library(plotly)
173
154
174
-
#mapboxToken <- paste(readLines(".mapbox_token"), collapse="") # You need your own token
155
+
mapboxToken <- paste(readLines("../.mapbox_token"), collapse="") # You need your own token
To plot on Mapbox maps with Plotly you "may" need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio). See our [Mapbox Map Layers](/r/mapbox-layers/) documentation for more information.
To plot on Mapbox maps with Plotly you `may` need a Mapbox account and a public [Mapbox Access Token](https://www.mapbox.com/studio), that you can add to your [Plotly Settings](https://plot.ly/settings/mapbox). See our [Mapbox Map Layers](/python/mapbox-layers/) documentation for more information. If you're using a Chart Studio Enterprise server, please see additional instructions [here](https://help.plot.ly/mapbox-atlas).
48
-
49
36
### How to draw a Line on a Map
50
37
51
38
To draw a line on your map, you either can use [Scattermapbox](https://plot.ly/r/reference/#scattermapbox) or [scattergeo](https://plot.ly/r/reference/#scattergeo) trace type in plotly. This example uses scattermapbox and defines the drawing [mode](https://plot.ly/python/reference/#scattermapbox-mode) to the combination of markers and line.
0 commit comments