简体   繁体   English

R plotly orca错误:找不到映射框访问令牌

[英]R plotly orca Error: No mapbox access token found

I read tutorial https://github.com/plotly/orca#installation and run commands in docker image: 我阅读了教程https://github.com/plotly/orca#installation并在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: 当我执行示例R代码时,出现错误:

> 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: 如果您遵循安装说明并指定了命令行orca ,则可以通过分配随机数来解决“未找到映射箱访问令牌”的问题:

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) . 这有助于使用plotly (4.8.0)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. PS:如果你安装最新版本的plotly(我测试它4.8.9000 ),那么它的工作原理没有设置一个随机mapbox令牌。 Install the latest plotly with: devtools::install_github('ropensci/plotly') 使用以下工具安装最新的plotly: devtools::install_github('ropensci/plotly')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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