I have an ordered factor variable that I would like to plot using ggplot2
. Is there any way I can use scale_color_viridis()
, a continuous color scale, with this ordered factor without casting the factor to numeric? The straightforward
iris$Sepal.Width <- ordered(iris$Sepal.Width)
ggplot(iris, aes(Sepal.Length, Petal.Length, color=Sepal.Width)) +
geom_point() +
scale_color_continuous()
doesn't work.