2

I'd like to know what I'm doing wrong here, why are colours not properly assigned? I want to avoid creating a new variable!! Many thanks!

sepal_values <- c(7.3, 7.0, 6.2, 5.6, 5.9, 5.7)

ggplot(data = filter(iris, !Species == "setosa"),
       aes(y = Petal.Length, x = Sepal.Length)) +
  geom_point(aes(colour = ifelse(Sepal.Length %in% sepal_values, "firebrick", "dodgerblue3")))

ggplot2_conditional_colour

user3262756
  • 649
  • 1
  • 9
  • 27

0 Answers0