Closed
Description
An error is generated when attempting to specify color scale labels as a plotmath expression vector. The error is also generated when using scale_fill_stepsn()
. I expected the color scale labels to be rendered using plotmath.
Here is code to reproduce the bug:
library(ggplot2)
data.frame(x = 1:5, y = 1:5) |>
ggplot(aes(x = x, y = y, color = y))+
geom_text(label = parse(text = paste0("x^", 1:5)))+
scale_color_stepsn(breaks = 1:5,
colors = c("red", "orange", "yellow","green", "blue"),
labels = parse(text = paste0("x^", 1:5)))
#> Error in `vec_size()`:
#> ! `x` must be a vector, not an expression vector.
Created on 2024-07-17 with reprex v2.1.0