简体   繁体   中英

R plotly orca Error: No mapbox access token found

I read tutorial https://github.com/plotly/orca#installation and run commands in docker image:

apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - && \
apt-get install -y nodejs libgconf-2-4 libgtk2.0-0 && \
npm install -g electron@1.8.4 orca --unsafe-perm=true --allow-root

OS details:

root@8a17254aeb9a:/# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.6 (stretch)
Release:    9.6
Codename:   stretch

but nothing happens when I execute:

root@8a17254aeb9a:/# which orca
/usr/bin/orca
root@8a17254aeb9a:/# orca
root@8a17254aeb9a:/# orca --help
root@8a17254aeb9a:/# electron
root@8a17254aeb9a:/# electron -v

and when I execute example R code I get error:

> library(plotly)
> p <- plot_ly(z = ~volcano) %>% add_surface()
> orca(p, "surface-plot.svg")
Error: No mapbox access token found. Obtain a token here
https://www.mapbox.com/help/create-api-access-token/
Once you have a token, assign it to an environment variable 
named 'MAPBOX_TOKEN', for example,
Sys.setenv('MAPBOX_TOKEN' = 'secret token')

I read a lot of tutorials and issues, but still have no answer. Can you help?

If you follow the installation instructions and have a command-line orca as specified, then the problem with the "No mapbox access token found" can be solved by assigning a random number:

library(plotly)
Sys.setenv(MAPBOX_TOKEN = 11122223333444) # it doesn't matter what number I put!

p <- plot_ly(x = 1:10, y = 1:10, color = 1:10)
orca(p, format = "svg", "plot.svg")

This worked for storing locally high quality images using plotly (4.8.0) and orca (1.2.1-1) .

PS: If you install the latest version of plotly (I tested it with 4.8.9000 ) then it works without setting a random mapbox token. Install the latest plotly with: devtools::install_github('ropensci/plotly')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM