Problem: All values of aesthetically mapped variable not displayed, I mapped the variable 'class' of mpg data set of ggplot2, but the plotly function is not displaying all of them.
Here is the code:
library(ggplot2)
library(plotly)
# using mpg data set, already loaded as a part of ggplot2
fig<-plot_ly(mpg,x=~cty, y=~hwy,
color=~drv,
frame = ~class,
type="scatter",
mode="markers")
fig
Below is the screenshot, following warning was shown: Warning message: In p$x$data[firstFrame] <- p$x$frames[[1]]$data : number of items to replace is not a multiple of replacement length
See on the upper right side only r's legend is shown, plus pertaining to the screenshot you have posted, the particular tab is on class: minivan which has all three types of drv so there should be three colors of markers in the plot but there is only one.