Using a pre-defined color palette in ggplot

后端 未结 4 1672
别那么骄傲
别那么骄傲 2020-11-27 04:14

Does anyone know how to use a pre-defined color palette in ggplot?

I have a vector of colors I would like to use:

rhg_cols <- c(\"#771C19\", \"#AA         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-27 04:35

    If the colours are a palette, use scale_colour_manual:

    ggplot(mydata, aes(factor(phone_partner_products), colour = colour_variable)) +
      scale_colour_manual(values = rhg_cols)
    

提交回复
热议问题