-
Notifications
You must be signed in to change notification settings - Fork 51
updating mapbox token #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
603b870
8ff0958
b3bf29e
38037c6
36a7f1a
9bdb137
1ed3847
8f0624d
dedeb6f
99fabef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ Imports: | |
forcats, | ||
ggplot2, | ||
haven, | ||
listviewer, | ||
hms, | ||
httr, | ||
jsonlite, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,15 +17,6 @@ output: | |
knitr::opts_chunk$set(message = FALSE, warning=FALSE) | ||
``` | ||
|
||
```{r, echo = FALSE} | ||
# Mapbox token for plotly | this one is for plot_mapbox figure | ||
mapboxToken <- paste("pk.eyJ1IjoicGxvdGx5bWFwYm94IiwiYSI6ImNqdnBvNDMyaT", | ||
"AxYzkzeW5ubWdpZ2VjbmMifQ.TXcBE-xg9BFdV2ocecc_7g", sep = "") | ||
|
||
# Setting mapbox token for R environment | ||
Sys.setenv("MAPBOX_TOKEN" = mapboxToken) | ||
``` | ||
|
||
### New to Plotly? | ||
|
||
Plotly's R library is free and open source!<br> | ||
|
@@ -336,11 +327,17 @@ Animations are currently only available in the [development package](https://plo | |
|
||
When adding buttons to Plotly charts, users have the option of styling the color, font, padding, and position of the buttons. The example below demostrates hot to apply different styling options. See all updatemenus styling attributes here: https://plot.ly/r/reference/#layout-updatemenus. | ||
|
||
#### Mapbox Access 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. If you're using a Chart Studio Enterprise server, please see additional instructions [here](https://help.plot.ly/mapbox-atlas). | ||
|
||
```{r} | ||
library(plotly) | ||
|
||
# make sure you have a Mapbox token https://www.mapbox.com/help/create-api-access-token/ | ||
# Sys.setenv('MAPBOX_TOKEN' = 'your mapbox token') | ||
mapboxToken <- paste(readLines("../.mapbox_token"), collapse="") # You need your own token | ||
|
||
# Setting mapbox token for R environment | ||
Sys.setenv("MAPBOX_TOKEN" = mapboxToken) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So I'm pretty sure that either this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From testing in my local dev environment, it seems like Edit: this turns out to be the case only if using the |
||
|
||
# read in wind turbines and farms data | ||
df_wind = read.csv('data/2805.csv') | ||
|
@@ -426,8 +423,8 @@ p <- plot_mapbox(df_sub, lat = ~lat_DD, lon = ~long_DD, mode = 'scattermapbox', | |
yanchor = "bottom", | ||
x = 1, | ||
y = 0, | ||
buttons=list(dark,basic,satellite)))) | ||
|
||
buttons=list(dark,basic,satellite)))) %>% | ||
config(mapboxAccessToken = Sys.getenv("MAPBOX_TOKEN")) | ||
|
||
p | ||
``` | ||
|
Uh oh!
There was an error while loading. Please reload this page.