Modify viridis palette in ggplot

前端 未结 2 1561
温柔的废话
温柔的废话 2021-01-06 09:23

I\'m trying to color a ggplot by a factor that\'s mostly numerical, like so:

iris %>%
  ggplot(aes(Sepal.Length, Sepal.Width, color = cut(Petal.Length, 0:         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-06 10:22

    Requires a call to scale_color_manual()

    iris %>%
      ggplot(aes(Sepal.Length, Sepal.Width, color = cut(Petal.Length, 0:7))) + 
      geom_point() + 
      scale_color_manual(values = c("red", viridis::viridis(6)))
    

提交回复
热议问题