R绘图体系ggplot2 基础篇:颜色搭配 (纠结症稳定剂)

PALETTE LIST

1. RColorBrewer palette

使用RColorBrewer包配色
安装并加载RColorBrewer包

install.packages("RColorBrewer")
library(RColorBrewer)
display.brewer.all()

2.colorspace

install.packages("colorspace")
library(colorspace)
hcl_palettes(plot = TRUE)

image

HCL palettes

Type:  Qualitative 
Names: Pastel 1, Dark 2, Dark 3, Set 2, Set 3, Warm, Cold, Harmonic, Dynamic

Type:  Sequential (single-hue) 
Names: Grays, Light Grays, Blues 2, Blues 3, Purples 2, Purples 3, Reds 2, Reds 3, Greens 2, Greens 3, Oslo

Type:  Sequential (multi-hue) 
Names: Purple-Blue, Red-Purple, Red-Blue, Purple-Orange, Purple-Yellow, Blue-Yellow, Green-Yellow, Red-Yellow, Heat, Heat 2,
       Terrain, Terrain 2, Viridis, Plasma, Inferno, Rocket, Mako, Dark Mint, Mint, BluGrn, Teal, TealGrn, Emrld, BluYl,
       ag_GrnYl, Peach, PinkYl, Burg, BurgYl, RedOr, OrYel, Purp, PurpOr, Sunset, Magenta, SunsetDark, ag_Sunset,
       BrwnYl, YlOrRd, YlOrBr, OrRd, Oranges, YlGn, YlGnBu, Reds, RdPu, PuRd, Purples, PuBuGn, PuBu, Greens, BuGn, GnBu,
       BuPu, Blues, Lajolla, Turku, Hawaii, Batlow

Type:  Diverging 
Names: Blue-Red, Blue-Red 2, Blue-Red 3, Red-Green, Purple-Green, Purple-Brown, Green-Brown, Blue-Yellow 2, Blue-Yellow 3,
       Green-Orange, Cyan-Magenta, Tropic, Broc, Cork, Vik, Berlin, Lisbon, Tofino

3. palette 1 (主要作为自带色谱的补充)

mycol <- c("#BD6263","#8EA325","#A9D179","#84CAC0","#F5AE6B","#BCB8D3","#4387B5")

mycol2 = c( "#E64B35B2", "#4DBBD5B2" ,"#00A087B2", "#3C5488B2", "#F39B7FB2",
"#8491B4B2", "#91D1C2B2", "#DC0000B2", "#7E6148B2")

4.The palette with grey or black:

cbPalette <- c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2",
"#D55E00", "#CC79A7")

cbbPalette <- c("#000000", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2",
"#D55E00", "#CC79A7")

5. 8 colors

color_8 <- c("#2873B3","#2EBEBE","#74B346","#167153","#F1CC2F","#7D4444","#A14462","#8264CC")
image

6. Colors more than 12

21 colors
mycol21 <- c("#004529","#088247","#7CC767",
"#223D6C","#5D90BA","#9ecae1",
"#8c510a","#bf812d","#D8D155",
"#b30000","#d73027","#fc9272",
"#7A142C","#E0367A","#df65b0",
"#4a1486","#6a51a3","#9e9ac8",
"#252525","#737373","#bdbdbd")

22 colors
mycol22 <- c("#35212e","#562e3c","#a14462","#eb998b",
"#fddbc8","#42465c","#356d67","#4c9568",
"#7fb961","#b0d45d","#ffe788","#b20000",
"#f06152","#7d4444","#9e6c69","#cca69c",
"#5066a1","#76afda","#abddff","#dcf2ff",
"#e8743c","#ffc556")

22 color edited
mycol22 <- c("#b0d45d","#7fb961","#4c9568","#356d67","#42465c","#5066a1",
"#76afda","#abddff","#dcf2ff","#fddbc8","#ffe788","#ffc556",
"#e8743c","#f06152","#b20000","#eb998b","#a14462","#cca69c",
"#9e6c69","#7d4444","#562e3c","#35212e")

A Wes Anderson style

# Install
install.packages("wesanderson")
# Load
library(wesanderson)

image

7.a series of palettes from pophelperShiny 2.1.1 (clik here)

1. palette set 1

image

2. palette set 2

image

3. palette set 3

image

8.最全颜色 (2128 palettes)

一步搞定各种配色,选paletteer 包就对了。
https://github.com/EmilHvitfeldt/paletteer
image
image

posted @ 2021-04-02 18:12  真小兽医  阅读(18057)  评论(0编辑  收藏  举报