Closed
Description
I've noticed this issue recently. Outliers in the variable mapped to colour cause the scale to alter in an (user) uncontrollable fashion. It usually results in a color scale that is not useful.
library(plotly)
library(viridis)
f <- rnorm(100)
plot_ly(x=f, y=f, color=f, colors=viridis(100))
## Looks fine...
f[[5]] <- 1e2
plot_ly(x=f, y=f, color=f, colors=viridis(100))
## Color scale has changed due to one outlier
This seems to be a plotly R issue - I had a quick check using codepen:
No outliers: https://codepen.io/alanoc/pen/GBNoRm
Outliers: https://codepen.io/alanoc/pen/VBmeLK