Add custom colors to ggplot

前端 未结 1 574
难免孤独
难免孤独 2021-01-21 09:13

My main goal is to color elements differently in my plot. To do so, I manually added an extra column with the desired color for each category:

1条回答
  •  深忆病人
    2021-01-21 10:11

    ggplot(mtcars) + 
        geom_point(aes(wt, mpg, size = disp, color = color)) + 
        scale_color_identity(guide = 'legend')
    

    0 讨论(0)
提交回复
热议问题