R语言mapsf包,mf_get_pal获取调色板

2021-07-13  本文已影响0人  youmigo

R语言mapsf包,mf_get_pal获取调色板

# Fri Jun 25 12:20:35 2021 -

# 字符编码:UTF-8
# R 版本:R x64 4.1 for window 10
# cgh163email@163.com
# 个人笔记不负责任,拎了个梨🍐✨
# .rs.restartR()
require(mapsf)
rm(list = ls());gc()

?   mf_get_pal  #   获取调色板。
cols <- mf_get_pal(n = 10, pal = "Reds 2")
plot(1:10, rep(1, 10), bg = cols, pch = 22, cex = 4)

cols <- mf_get_pal(n = c(3, 7), pal = c("Reds 2", "Greens"))
plot(1:10, rep(1, 10), bg = cols, pch = 22, cex = 4)
cols <- mf_get_pal(n = c(5, 5), pal = c("Reds 2", "Greens"))
plot(1:10, rep(1, 10), bg = cols, pch = 22, cex = 4)
cols <- mf_get_pal(n = c(7, 3), pal = c("Reds 2", "Greens"))
plot(1:10, rep(1, 10), bg = cols, pch = 22, cex = 4)
cols <- mf_get_pal(n = c(5, 5), pal = c("Reds 2", "Greens"), neutral = "grey")
plot(1:11, rep(1, 11), bg = cols, pch = 22, cex = 4)
opar <- par(bg = "black")
cols <- mf_get_pal(n = c(7, 3), pal = c("Reds 2", "Greens"), alpha = c(.3, .7))
plot(1:10, rep(1, 10), bg = cols, pch = 22, cex = 4)
par(opar)
cols <- mf_get_pal(
  n = c(5, 5), pal = c("Reds 2", "Greens"),
  rev = c(TRUE, TRUE)
)
plot(1:10, rep(1, 10), bg = cols, pch = 22, cex = 4)
dev.copy(png, "1.png");dev.off()

image.png
image.png
上一篇下一篇

猜你喜欢

热点阅读