Closed Shians closed 5 years ago
It also does not appear to respect the paired colours property of the palette regarding successive factor levels.
I don't quite follow -- can you make an argument that the ggplot2 behavior is objectively better?
This is specifically regarding the "Paired" palette
Based on the name I assume the colours are for presenting data in pairs, therefore having similar pairs of colours shown above. This can be useful for data as presented here.
with the effect that meals have similar colours and the numbering has similar intensity. In ggplot2 this is achieved by ordering your paired levels to be adjacent to each other. In plot_ly it requires going around the canonical interface for accessing "Paired". Obviously the choice is totally arbitrary for the palettes with no structure.
Both of those plot_ly()
code blocks produce the same result for me, is this not what you'd expect?
On my MacOS 10.13.6 system with Plotly 4.8.0, running
plotly::plot_ly(data = iris, x = ~Sepal.Length, y = ~Petal.Length, color = ~Species, colors = "Paired")
shows
I think back when I submitted the issue the behaviour with 3 levels was to pick colours from the two ends and centre of a palette.
Ohhh, this is actually due to a change in scales::col_factor()
-- if you install the Github version you'll get the result in https://github.com/ropensci/plotly/issues/1120#issuecomment-457426736
Closing since the new scales gives you the behavior you'd expect, right?
When using the "Paired" palette the colours do not appear as they do in ggplot2. It also does not appear to respect the paired colours property of the palette regarding successive factor levels.
It can be made to work with