Description
guide_coloursteps()
and guide_bins()
seems to give incorrect guide when breaks are not sorted in increasing direction.
In the example below, we can see the coloursteps aren't right. The same happens with continuous scales, but binned scales come with coloursteps by default, so that reprex was more minimal. This doesn't only happen when the breaks are sorted in descending order as in the example below, but this generally seems to happen when they're not increasing.
library(ggplot2)
p <- ggplot(mpg, aes(displ, hwy, colour = cty)) +
geom_point()
p + scale_colour_viridis_b(breaks = seq(30, 10, by = -5))
You'd expect the guide to look like this:
p + scale_colour_viridis_b(breaks = seq(10, 30, by = 5))
Created on 2023-01-18 with reprex v2.0.2
I think the fix would be a simple sorting step in the guide training.