【问题标题】:Plotly not displaying correctly in RStudio Viewer在 RStudio 查看器中无法正确显示
【发布时间】:2017-10-13 04:07:50
【问题描述】:

我第一次使用plotly 包来生成3D 绘图。尽管我正在学习本教程,但绘图点不会出现在 RStudio 查看器中。只是一个空的网格。

library(plotly)
packageVersion('plotly')
#[1] ‘4.6.0’

mtcars$am[which(mtcars$am == 0)] <- 'Automatic'
mtcars$am[which(mtcars$am == 1)] <- 'Manual'
mtcars$am <- as.factor(mtcars$am)

p <- plot_ly(mtcars, x = ~wt, y = ~hp, z = ~qsec, color = ~am, colors = c('#BF382A', '#0C4B8E')) %>%
  add_markers() %>%
  layout(scene = list(xaxis = list(title = 'Weight'),
                      yaxis = list(title = 'Gross horsepower'),
                      zaxis = list(title = '1/4 mile time')))

但是,当我在网络浏览器中打开绘图时,点显示得很好。

我在这里看到一个类似的问题:Plotly in RStudio viewer

但是更新到最新版本的 RStudio 后,点仍然没有出现。我正在使用 R 版本 3.3.3

【问题讨论】:

    标签: r plot rstudio plotly


    【解决方案1】:

    plotly 的 4.6.0 版本与 Rstudio 的 1.0.143 版本之间似乎不兼容。尝试使用plotly的release 4.5.6版本:

    devtools::install_version("plotly", version = "4.5.6", 
                   repos = "http://cran.us.r-project.org")
    

    效果很好,情节点现在出现在我的 RStudio 的最新版本中。

    【讨论】:

      猜你喜欢
      • 2016-11-28
      • 1970-01-01
      • 1970-01-01
      • 2013-12-28
      • 1970-01-01
      • 2014-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多