ggplot配色修改方法

获得一个好看的配色可以通过一些专业配色的网站,比如chinavid,或者从ggsci包里挑选。颜色选好了,如果是ggsci包的话好办,直接scale_color_xxx或scale_fill_xxx就行,但是自己选的配色要怎么调呢?

  • 对于二色梯度,可以使用scale_colour_gradient和scale_fill_gradient
  • 对于三色梯度,可以使用scale_colour_gradient2和scale_fill_gradient2
  • 对于N色梯度,可以使用scale_colour_gradientn和scale_fill_gradientn
  • 对于离散的映射,可以使用scale_color_manual和scale_fill_manual
  • 使用RColorBrewer调色板,可以用scale_color_brewer和scale_fill_brewer
  • 使用灰度图,则用scale_color_grey和scale_fill_grey
  • 使用调色板做梯度,有scale_color_distiller和scale_fill_distiller

ggplot配色修改方法
https://b.limour.top/1964.html
Author
Limour
Posted on
August 10, 2022
Licensed under