[英]Plotly not displaying correctly in RStudio Viewer
我是第一次使用plotly
包来生成3D图。 虽然我按照教程进行操作,但绘图点不会出现在RStudio Viewer中。 只是一个空格子。
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')))
但是,当我在网络浏览器中打开图表时,积分显示正常。
我在这里看到一个类似的问题: 在RStudio查看器中的Plotly
但在更新到最新版本的RStudio之后,这些点仍未出现。 我使用的是R版本3.3.3
这似乎是4.6.0版本的plotly
与Rstudio的1.0.143版本之间不兼容。 尝试使用版本4.5.6版本的plotly
:
devtools::install_version("plotly", version = "4.5.6",
repos = "http://cran.us.r-project.org")
它工作得很好,情节点现在出现在我的RStudio的最新版本中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.