https://www.omicsclass.com/article/746
https://blog.csdn.net/weixin_41952483/article/details/79872057
https://mp.weixin.qq.com/s?__biz=MzI5MTcwNjA4NQ==&mid=2247485182&idx=1&sn=7b5c1d800560eddcf898ed410720a2a3&scene=21#wechat_redirect
展示色标对应的颜色
show_col(colours=, labels=, cex_label=)
是
scales
包中的一个函数
show_col(rgb(1,0.1,0.5), cex_label=1) '#示例一
show_col(hcl.colors(n=12, palette = "viridis", alpha = 1, rev = T), cex_label=1, col=4) #示例二
示例一
示例二
1. RColorBrewer
包
1.1 brewer.pal()
用来生成色标
brewer.pal(name=, n=)
name=
: give the name to makes the color palettes, includingBlues BuGn BuPu GnBu Greens Greys Oranges OrRd PuBu PuBuGn PuRd Purples RdPu Reds YlGn YlGnBu YlOrBr YlOrRd BrBG PiYG PRGn PuOr RdBu RdGy RdYlBu RdYlGn Spectral
n=
: number of color palettes to make
> brewer.pal(n=3, name="BrBG")
[1] "#D8B365" "#F5F5F5" "#5AB4AC"
1.2 display.brewer.pal()
用来展示选择的颜色
display.brewer.pal(name=, n=)
name=
: give the name to makes the color palettes, includingBlues BuGn BuPu GnBu Greens Greys Oranges OrRd PuBu PuBuGn PuRd Purples RdPu Reds YlGn YlGnBu YlOrBr YlOrRd BrBG PiYG PRGn PuOr RdBu RdGy RdYlBu RdYlGn Spectral
n=
: number of color palettes to make
display.brewer.pal(name="Blues", n=5) '#示例一
示例一
1.3 display.brewer.all()
用来同时展示多个色系
display.brewer.all(type=, select=, n=)
type=
: 展示种类,包括seq
,div
,qual
,all
select=
: 用来展示的色系
n=
: 每个色系展示的颜色数
display.brewer.all(type = "seq") '#查看单色渐变色板,示例一
display.brewer.all(type = "div") #查看双色渐变色板,示例二
display.brewer.all(type = "qual") #查看离散色板,示例三
示例一
示例二
示例三
2. color()
内置颜色变量
> colors()[1:5]
[1] "white" "aliceblue" "antiquewhite" "antiquewhite1" "antiquewhite2"
3. grey()
生成灰色色标
> gray((1:10)/10)
[1] "#1A1A1A" "#333333" "#4D4D4D" "#666666" "#808080" "#999999" "#B3B3B3" "#CCCCCC" "#E6E6E6" "#FFFFFF"
4. hcl.colors()
hcl.colors(n=10, palette = "viridis", alpha = 0, rev = T)
[1] "#FDE33300" "#BBDD3800" "#6CD05E00" "#00BE7D00" "#00A89000" "#008E9800" "#00709400" "#18508600" "#422C7000" "#4B005500"
5. rgb()
根据红黄蓝三原色来手动调制颜色,返回值为生成颜色的色标
rgb(red=, green=, blue=, alpha=)
red=
,green=
,blue=
: 介于0到1之间的值,表示对应颜色的深浅
alpha=
: 透明度
> rgb(0.5, 1, 0.3)
[1] "#80FF4D"
网友评论