配色大全
c4a( Colors for all)
mtennekes/cols4all: Colors for all (R package) (github.com)
remotes::install_github("mtennekes/cols4all")
install.packages("kableExtra")
library(cols4all)
c4a_gui()
# Select the palette "kelly" with 7 colors
c4a("kelly", 7)
#> [1] "#F2F3F4" "#222222" "#F3C300" "#875692" "#F38400" "#A1CAF1" "#BE0032"
# find names of hcl palettes that are diverging
c4a_palettes(type = "div", series = "hcl")
#> [1] "hcl.blue_red1" "hcl.blue_red2" "hcl.blue_red3" "hcl.red_green"
#> [5] "hcl.purple_green" "hcl.purple_brown" "hcl.green_brown" "hcl.blue_yellow2"
#> [9] "hcl.blue_yellow3" "hcl.green_orange" "hcl.cyan_magenta"
# select purple green palette from the hcl series:
c4a("hcl.purple_green", 11)
#> [1] "#492050" "#82498C" "#B574C2" "#D2A9DB" "#E8D4ED" "#F1F1F1" "#C8E1C9"
#> [8] "#91C392" "#4E9D4F" "#256C26" "#023903"
# get the associated color for missing values
c4a_na("hcl.purple_green")
#> [1] "#868686"
主要功能:
c4a_guiGUI(闪亮的应用程序)以查看和分析调色板
c4a获取调色板的颜色
选项板名称和属性:
c4a_palettes获取可用的调色板名称
c4a_series获取可用的系列名称
c4a_info获取调色板信息(如类型和最大颜色数)
c4a_citation演示如何引用调色板(使用 bibtex 代码)。
.P通过该环境可以浏览具有自动完成功能的调色板名称(使用$)
导入和导出选项板:
c4a_palettes_add添加调色板
c4a_palettes_remove删除调色板
c4a_sysdata_import导入系统数据
c4a_sysdata_export导出系统数据
ggplot2
scale_<aesthetic>_<mapping>c4a<type>例如: 将c4a添加到 ggplot2。scale_color_continuous_c4a_div
MetBrewer
install.packages("MetBrewer")
install.packages("devtools")
devtools::install_github("BlakeRMills/MetBrewer")
met.brewer("VanGogh1")
met.brewer("Greek", direction=-1)
met.brewer("Cassatt2", 4, override.order=TRUE)
library(ggplot2)
ggplot(data=iris, aes(x=Species, y=Petal.Length, fill=Species)) +
geom_violin() +
scale_fill_manual(values=met.brewer("Greek", 3))
ggplot(data=iris, aes(x=Sepal.Length, y=Sepal.Width, color=Species)) +
geom_point(size=2) +
scale_color_manual(values=met.brewer("Renoir", 3))
ggplot(data=iris, aes(x=Species, y=Sepal.Width, color=Sepal.Width)) +
geom_point(size=3) +
scale_color_gradientn(colors=met.brewer("Isfahan1"))
MetBrewer::met.brewer Met Palette Generator
MetBrewer::scale_color_met_c MetBrewer palettes for plotting with ggplot2
MetBrewer::scale_color_met_d MetBrewer palettes for plotting with ggplot2
MetBrewer::scale_colour_met_c MetBrewer palettes for plotting with ggplot2
MetBrewer::scale_colour_met_d MetBrewer palettes for plotting with ggplot2
MetBrewer::scale_fill_met_c MetBrewer palettes for plotting with ggplot2
MetBrewer::scale_fill_met_d MetBrewer palettes for plotting with ggplot
image.png
paint
MilesMcBain/paint: paint the data (github.com)
install.packages(
"paint",
repos = c(mm = "https://milesmcbain.r-universe.dev", getOption("repos")))
library(spData)
library(paint)
paint(nz)
#> sf [16, 7]
#> active geometry column: geom (MULTIPOLYGON)
#> crs: 2193 (NZGD2000 / New Zealand Transverse Mercator 2000)
#> crs unit: metre
#> Name chr Northland Auckland Waikato Bay of Plenty ~
#> Island chr North North North North North North
#> Land_area dbl 12500.561149 4941.572557 23900.036383 120~
#> Population dbl 175500 1657200 460100 299900 48500 164000
#> Median_income int 23400 29600 27900 26200 24400 26100
#> Sex_ratio dbl 0.942453 0.944286 0.95205 0.928039 0.9349~
#> geom sfc MPOLY 1,784B MPOLY 2,288B MPOLY 2,376B MP~
image.png
RColorBrewer
library(RColorBrewer)
?RColorBrewer
brewer.pal(n, name)
display.brewer.pal(n, name)
display.brewer.all(n=NULL, type="all", select=NULL, exact.n=TRUE,
colorblindFriendly=FALSE)
brewer.pal.info
Accent 8
Dark2 8
Paired 12
Pastel1 9
Pastel2 8
Set1 9
Set2 8
Set3 12
display.brewer.pal(11,"PiYG")
display.brewer.pal(4,"PiYG")
display.brewer.pal(9, "Set1")
display.brewer.pal(9, "Set2")
display.brewer.pal(11,"Pastel1")
display.brewer.pal(4,"Pastel2") display.brewer.pal(9, "Paired")