离线使用 plotly r 包时有关用户名的错误消息

use*_*999 6 r plotly htmlwidgets

我正在尝试开始对 R 使用 plotly,但是我遇到了关于用户名的错误。当我尝试执行以下代码时...

test=ggplot(diamonds,aes(x=diamonds$carat,y=diamonds$price))+geom_point()
test2=plotly(test)
plotly(test)
Run Code Online (Sandbox Code Playgroud)

...我收到错误消息:

Storing 'username' as the environment variable 'plotly_username'
Error in Sys.setenv(plotly_username = username) : 
  wrong length for argument
Run Code Online (Sandbox Code Playgroud)

我认为 plotly 的 R 包可以通过 htmlwidgets 在没有用户名的情况下使用。据我所知,我使用的是最新版本的 plotly、ggplot 和 htmlwidgets。我究竟做错了什么?

jch*_*kow 6

你必须使用 ggplotly()

所以,

test <- ggplot(diamonds,aes(x = carat,y = price))+ geom_point()

ggplotly(test)