Incorrect display in RStudio Viewer

I am using a package plotly

for creating 3D graphics. Although I am following this tutorial, the graph points are not showing in RStudio Viewer. Just an empty grid.enter image description here

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 dots are displayed well.

I see a similar question here: Configure in RStudio viewer

But after updating to the latest version of RStudio, the dots are still not showing. I am using R version 3.3.3

+3


source to share


1 answer


There seems to be an incompatibility between the 4.6.0 plotly

release and the RSTudio 1.0.143 release. Try using version 4.5.6 release plotly

:

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

      



It works well and plot points now appear in the latest version of my RStudio.

+2


source







All Articles