snapcrack
snapcrack

Reputation: 1811

Data not appearing in plotly 3d scatterplot

I'm trying to render some data in a 3d scatterplot in plotly and none of it was showing up. I decided to try plotly's sample graph, but it's not working either:

library(plotly)

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')))

I get:

enter image description here

I'm using RStudio 1.0.143, and my version of R is 3.2.3. I've tried running this on a Windows 10 VM as well with the same result.

Upvotes: 1

Views: 994

Answers (1)

Edgar Santos
Edgar Santos

Reputation: 3514

The issue arises with the current version of plotly (4.7.0). I would suggest installing a previuos version of plotly and then run again your codes:

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

enter image description here

Upvotes: 1

Related Questions