R语言thematic包,无障碍色卡和渐变
# Sat Jan 23 15:33:27 2021 -
# 字符编码:UTF-8
# R 版本:R x64 4.0.3 for window 10
# cgh163email@163.com
# 个人笔记不负责任
# —— 拎了个梨🍐
.rs.restartR()
require(thematic)
rm(list=ls());gc()
?okabe_ito # 色盲色卡
okabe_ito()
# [1] "#E69F00" "#009E73" "#0072B2" "#CC79A7" "#999999" "#D55E00" "#F0E442" "#56B4E9"
?sequential_gradient
# Sat Jan 23 15:38:58 2021 -----渐变色-------------------------
require(ggplot2)
# 顺序色阶的控制参数
fg <- sequential_gradient(1, 0)
thematic_on("black", "white", "#FFFF00", sequential = fg)
ggplot2::qplot(1:100, 1:100, color = 1:100)
ggsave(filename = '渐变色.jpg',dpi=200)
#从强调色渐变->背景色
bg <- sequential_gradient(0, 1)
thematic_on("black", "white", "#FFCC99", sequential = bg)
ggplot2::qplot(1:10, 1:10, color = 1:10)
ggsave(filename = '前景渐变到背景色.jpg',dpi = 200)
#混合渐变(着色,fg,0.5)->混合渐变(着色,bg,0.5)
mix <- sequential_gradient(0.5, 0.5)
thematic_on("black", "white", "#990033", sequential = mix)
ggplot2::qplot(1:10, 1:10, color = 1:10)
ggsave(filename = '混合渐变色.jpg',dpi=200)
# 从背景色开始渐变到目标色
mix_flip <- sequential_gradient(0.5, 0.5, fg_low = FALSE)
thematic_on("black", "white", "#003300", sequential = mix_flip)
ggplot2::qplot(1:10, 1:10, color = 1:10)
ggsave(filename = '从背景色开始渐变到目标色.jpg',dpi=200)
# Sat Jan 23 15:38:24 2021 --end