Reputation: 4309
I am using the plotly
package for the first time to generate 3D plots. Although I am following the tutorial, the plot points don't appear in the RStudio Viewer. Just an empty grid.
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')))
However, when I open the plot in a web browser, the points show up fine.
I see a similar question here: Plotly in RStudio viewer
But after updating to the latest version of RStudio the points still do not appear. I am using R version 3.3.3
Upvotes: 4
Views: 3135
Reputation: 24262
It seems an incompatibility between the 4.6.0 release of plotly
and the 1.0.143 release of Rstudio. Try using the release 4.5.6 release of plotly
:
devtools::install_version("plotly", version = "4.5.6",
repos = "http://cran.us.r-project.org")
It works nicely and the plot points now appear in the latest release of my RStudio.
Upvotes: 4