Skip to content

Commit e594d84

Browse files
author
Joseph Damiba
committed
remove mapbox token from ci
1 parent 10da03e commit e594d84

10 files changed

+26
-138
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
- run:
4040
name: build site and perform front-matter checks
4141
command: |
42+
echo ${mapbox_token} > .mapbox_token
4243
rm -rf build
4344
mkdir build
4445
mkdir build/ggplot2

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
# Session Data files
66
.RData
77

8+
#mapbox dev token
9+
.mapbox_token
10+
811
# Example code in package build process
912
*-Ex.R
1013

r/2017-01-19-buttons.Rmd

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ output:
1717
knitr::opts_chunk$set(message = FALSE, warning=FALSE)
1818
```
1919

20-
```{r, echo = FALSE}
21-
# Mapbox token for plotly | this one is for plot_mapbox figure
22-
mapboxToken <- paste("pk.eyJ1IjoicGxvdGx5LWRvY3MiLCJhIjoiY2s1Mn",
23-
"NtODFwMDE4YjNscG5oYWNydXFxYSJ9.AquTxb6AI-oo7TWt01YQ9Q", sep = "")
24-
25-
# Setting mapbox token for R environment
26-
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
27-
```
28-
2920
### New to Plotly?
3021

3122
Plotly's R library is free and open source!<br>
@@ -339,9 +330,6 @@ When adding buttons to Plotly charts, users have the option of styling the color
339330
```{r}
340331
library(plotly)
341332
342-
# make sure you have a Mapbox token https://www.mapbox.com/help/create-api-access-token/
343-
# Sys.setenv('MAPBOX_TOKEN' = 'your mapbox token')
344-
345333
# read in wind turbines and farms data
346334
df_wind = read.csv('data/2805.csv')
347335
df_farms = read.csv('https://plot.ly/~jackp/17256.csv', skipNul = TRUE)
@@ -428,7 +416,6 @@ p <- plot_mapbox(df_sub, lat = ~lat_DD, lon = ~long_DD, mode = 'scattermapbox',
428416
y = 0,
429417
buttons=list(dark,basic,satellite))))
430418
431-
432419
p
433420
```
434421

r/2017-02-27-scattermapbox.Rmd

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ thumbnail: thumbnail/scatter-mapbox.jpg
1717
knitr::opts_chunk$set(message = FALSE, warning=FALSE)
1818
```
1919

20-
```{r, echo = FALSE}
21-
# Mapbox token for plotly | this one is for plot_mapbox figure
22-
mapboxToken <- paste("pk.eyJ1IjoicGxvdGx5LWRvY3MiLCJhIjoiY2s1Mn",
23-
"NtODFwMDE4YjNscG5oYWNydXFxYSJ9.AquTxb6AI-oo7TWt01YQ9Q", sep = "")
24-
25-
# Setting mapbox token for R environment
26-
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
27-
```
28-
2920
### New to Plotly?
3021

3122
Plotly's R library is free and open source!<br>
@@ -37,20 +28,13 @@ We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-docume
3728

3829
Version 4 of Plotly's R package is now [available](https://plot.ly/r/getting-started/#installation)!<br>
3930
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/.
4831

4932
```{r}
5033
library(plotly)
5134
packageVersion('plotly')
5235
```
5336

37+
5438
### Basic Example
5539

5640
```{r}

r/2017-04-12-county-level-choropleth.Rmd

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ thumbnail: thumbnail/county-level-choropleth.jpg
1616
knitr::opts_chunk$set(message = FALSE, warning=FALSE)
1717
```
1818

19-
```{r, echo = FALSE}
20-
# Mapbox token for plotly | this one is for plot_mapbox figure
21-
mapboxToken <- paste("pk.eyJ1IjoicGxvdGx5LWRvY3MiLCJhIjoiY2s1Mn",
22-
"NtODFwMDE4YjNscG5oYWNydXFxYSJ9.AquTxb6AI-oo7TWt01YQ9Q", sep = "")
23-
24-
# Setting mapbox token for R environment
25-
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
26-
```
27-
2819
### New to Plotly?
2920

3021
Plotly's R library is free and open source!<br>
@@ -41,10 +32,6 @@ library(plotly)
4132
packageVersion('plotly')
4233
```
4334

44-
### Mapbox Access Token
45-
46-
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-
4835
### Creating Polygon Boundaries
4936

5037
```{r}
@@ -147,16 +134,6 @@ p
147134
```
148135

149136
### 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).
152-
153-
```{r, results = 'hide'}
154-
library(plotly)
155-
156-
Sys.setenv('MAPBOX_TOKEN' = 'your_mapbox_token_here')
157-
```
158-
159-
160137
```{r}
161138
library(plotly)
162139

r/2018-06-22-sf.Rmd

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ thumbnail: thumbnail/sf.jpg
1616
knitr::opts_chunk$set(message = FALSE, warning=FALSE)
1717
```
1818

19-
```{r, echo = FALSE}
20-
# Mapbox token for plotly | this one is for plot_mapbox figure
21-
mapboxToken <- paste("pk.eyJ1IjoicGxvdGx5bWFwYm94IiwiYSI6ImNqdnBvNDMyaT",
22-
"AxYzkzeW5ubWdpZ2VjbmMifQ.TXcBE-xg9BFdV2ocecc_7g", sep = "")
23-
24-
# Setting mapbox token for R environment
25-
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
26-
```
27-
2819
### New to Plotly?
2920

3021
Plotly's R library is free and open source!<br>

r/2019-09-20-filled-area-on-mapbox.Rmd

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ thumbnail: thumbnail/area.jpg
1717
knitr::opts_chunk$set(message = FALSE, warning=FALSE)
1818
```
1919

20-
```{r, echo = FALSE}
21-
# Mapbox token for plotly | this one is for plot_mapbox figure
22-
mapboxToken <- paste("pk.eyJ1IjoicGxvdGx5LWRvY3MiLCJhIjoiY2s1Mn",
23-
"NtODFwMDE4YjNscG5oYWNydXFxYSJ9.AquTxb6AI-oo7TWt01YQ9Q", sep = "")
24-
25-
# Setting mapbox token for R environment
26-
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
27-
```
28-
2920
### New to Plotly?
3021

3122
Plotly's R library is free and open source!<br>
@@ -42,10 +33,6 @@ library(plotly)
4233
packageVersion('plotly')
4334
```
4435

45-
### Mapbox Access Token
46-
47-
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-
4936
### How to Show an Area on a Map
5037

5138
There are three different ways to show an area in a mapbox:

r/2019-09-20-mapbox-layers.Rmd

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,6 @@ library(plotly)
3333
packageVersion('plotly')
3434
```
3535

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/.
39-
40-
```{r, results = 'hide'}
41-
library(plotly)
42-
Sys.setenv('MAPBOX_TOKEN' = 'your_mapbox_token_here')
43-
```
44-
45-
```{r, echo = FALSE}
46-
# Mapbox token for plotly | this one is for plot_mapbox figure
47-
mapboxToken <- paste("eyJ1IjoicGxvdGx5bWFwYm94IiwiYSI6ImNqdnBvNDMyaT",
48-
"AxYzkzeW5ubWdpZ2VjbmMifQ.TXcBE-xg9BFdV2ocecc_7g", sep = "")
49-
50-
# Setting mapbox token for R environment
51-
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
52-
```
53-
5436
### How Layers work in Mapbox Maps
5537

5638
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.
@@ -60,21 +42,6 @@ Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
6042
<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>
6143
</ol>
6244

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-
7845
### OpenStreetMap Tiles, no Token Needed
7946

8047
Here is a simple map rendered with "open-street-map" tiles, without needing a Mapbox Access Token.
@@ -95,7 +62,7 @@ p <- us_cities %>%
9562
mapbox = list(
9663
style = 'open-street-map',
9764
zoom =2.5,
98-
center = list(lon = -88, lat = 34)))
65+
center = list(lon = -88, lat = 34)))
9966
10067
p
10168
```
@@ -164,14 +131,31 @@ p <- us_cities %>%
164131
p
165132
```
166133

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+
167148
#### Dark Tiles from Mapbox Service: Free Token Needed
168149

169150
Here is a map rendered with the `"dark"` style from the Mapbox service, which requires an Access Token:
170151

171152
```{r}
172153
library(plotly)
173154
174-
#mapboxToken <- paste(readLines(".mapbox_token"), collapse="") # You need your own token
155+
mapboxToken <- paste(readLines("../.mapbox_token"), collapse="") # You need your own token
156+
157+
# Setting mapbox token for R environment
158+
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
175159
176160
us_cities = read.csv("https://raw.githubusercontent.com/plotly/datasets/master/us-cities-top-1k.csv")
177161
@@ -185,9 +169,9 @@ p <- us_cities %>%
185169
layout(
186170
mapbox = list(
187171
style = 'dark',
188-
accesstoken = mapboxToken,
189172
zoom =2.5,
190-
center = list(lon = -88, lat = 34)))
173+
center = list(lon = -88, lat = 34))) %>%
174+
config(accesstoken = mapboxToken)
191175
192176
p
193177
```

r/2019-09-23-mapbox-density.Rmd

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ thumbnail: thumbnail/mapbox-density.png
1717
knitr::opts_chunk$set(message = FALSE, warning=FALSE)
1818
```
1919

20-
```{r, echo = FALSE}
21-
# Mapbox token for plotly | this one is for plot_mapbox figure
22-
mapboxToken <- paste("pk.eyJ1IjoicGxvdGx5LWRvY3MiLCJhIjoiY2s1Mn",
23-
"NtODFwMDE4YjNscG5oYWNydXFxYSJ9.AquTxb6AI-oo7TWt01YQ9Q", sep = "")
24-
25-
# Setting mapbox token for R environment
26-
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
27-
```
28-
2920
### New to Plotly?
3021

3122
Plotly's R library is free and open source!<br>
@@ -42,10 +33,6 @@ library(plotly)
4233
packageVersion('plotly')
4334
```
4435

45-
### Mapbox Access Token
46-
47-
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.
48-
4936
#### Stamen Terrain Tile, no Token Needed
5037

5138
```{r}

r/2019-09-27-lines-on-mapbox.Rmd

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ thumbnail: thumbnail/line_mapbox.jpg
1717
knitr::opts_chunk$set(message = FALSE, warning=FALSE)
1818
```
1919

20-
```{r, echo = FALSE}
21-
# Mapbox token for plotly | this one is for plot_mapbox figure
22-
mapboxToken <- paste("pk.eyJ1IjoicGxvdGx5LWRvY3MiLCJhIjoiY2s1Mn",
23-
"NtODFwMDE4YjNscG5oYWNydXFxYSJ9.AquTxb6AI-oo7TWt01YQ9Q", sep = "")
24-
25-
# Setting mapbox token for R environment
26-
Sys.setenv("MAPBOX_TOKEN" = mapboxToken)
27-
```
28-
2920
### New to Plotly?
3021

3122
Plotly's R library is free and open source!<br>
@@ -42,10 +33,6 @@ library(plotly)
4233
packageVersion('plotly')
4334
```
4435

45-
### Mapbox Access Token
46-
47-
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-
4936
### How to draw a Line on a Map
5037

5138
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

Comments
 (0)