Closed
Description
It always gives
Error in `check_breaks_labels()`:
! `breaks` and `labels` must have the same length
Reprex
library(tidyverse)
#works
mtcars %>%
ggplot(aes(hp, mpg, color = mpg)) +
geom_point() +
scale_color_stepsn(
colors = c("#dd3497",
"#ae017e",
"#7a0177",
"#49006a"),
breaks = c(15,20,25),
#labels = c("<15","15 text","20 text","25 text",">25")
)+
guides(color = guide_colorsteps(show.limits = TRUE))
#doesn't work
mtcars %>%
ggplot(aes(hp, mpg, color = mpg)) +
geom_point() +
scale_color_stepsn(
colors = c("#dd3497",
"#ae017e",
"#7a0177",
"#49006a"),
breaks = c(15,20,25),
labels = c("<15","15 text","20 text","25 text",">25")
)+
guides(color = guide_colorsteps(show.limits = TRUE))
#> Error in `check_breaks_labels()`:
#> ! `breaks` and `labels` must have the same length
Created on 2022-10-08 by the reprex package (v2.0.1)