色の16進数表記をいちいち出すのがめんどうなので、メモ
の前に
RColor Brewerでよく使うコマンド
library(RColorBrewer)
#全てのカラーパレットの表示
display.brewer.all(n = NULL,
type = "all",
select = NULL,
colorblindFriendly = FALSE)
##これだけでも良い
display.brewer.all()
#1つのカラーパレットの表示
display.brewer.pal(n = 8, name = 'Dark2')
#色の16進数表記を抽出
##nは3以上でないと(なぜか)エラーが出る
brewer.pal(n = 4, name = "Dark2")
##output
##[1] "#1B9E77" "#D95F02" "#7570B3" "#E7298A"
16進数表記一覧
色分けでよく使うセットのみとなっています。
Set1
> brewer.pal(n = 8, name = "Set1")
[1] "#E41A1C" "#377EB8" "#4DAF4A" "#984EA3" "#FF7F00" "#FFFF33"
[7] "#A65628" "#F781BF"
Set2
> brewer.pal(n = 8, name = "Set2")
[1] "#66C2A5" "#FC8D62" "#8DA0CB" "#E78AC3" "#A6D854" "#FFD92F"
[7] "#E5C494" "#B3B3B3"
Set3
> brewer.pal(n = 12, name = "Set3")
[1] "#8DD3C7" "#FFFFB3" "#BEBADA" "#FB8072" "#80B1D3" "#FDB462"
[7] "#B3DE69" "#FCCDE5" "#D9D9D9" "#BC80BD" "#CCEBC5" "#FFED6F"
Pastel1
> brewer.pal(n = 9, name = "Pastel1")
[1] "#FBB4AE" "#B3CDE3" "#CCEBC5" "#DECBE4" "#FED9A6" "#FFFFCC"
[7] "#E5D8BD" "#FDDAEC" "#F2F2F2"
Pastel2
> brewer.pal(n = 8, name = "Pastel2")
[1] "#B3E2CD" "#FDCDAC" "#CBD5E8" "#F4CAE4" "#E6F5C9" "#FFF2AE"
[7] "#F1E2CC" "#CCCCCC"
Paired
> brewer.pal(n = 12, name = "Paired")
[1] "#A6CEE3" "#1F78B4" "#B2DF8A" "#33A02C" "#FB9A99" "#E31A1C"
[7] "#FDBF6F" "#FF7F00" "#CAB2D6" "#6A3D9A" "#FFFF99" "#B15928"
Dark2
> brewer.pal(n = 8, name = "Dark2")
[1] "#1B9E77" "#D95F02" "#7570B3" "#E7298A" "#66A61E" "#E6AB02"
[7] "#A6761D" "#666666"
Accent
[1] "#7FC97F" "#BEAED4" "#FDC086" "#FFFF99" "#386CB0" "#F0027F"
[7] "#BF5B17" "#666666"
Spectral
> brewer.pal(n = 11, name = "Spectral")
[1] "#9E0142" "#D53E4F" "#F46D43" "#FDAE61" "#FEE08B" "#FFFFBF"
[7] "#E6F598" "#ABDDA4" "#66C2A5" "#3288BD" "#5E4FA2"
RColorBrewer以外の色が欲しい場合
- Rのカラーパレットをまとめたサイト:TOP R COLOR PALETTES TO KNOW FOR GREAT DATA VISUALIZATION
- 色の名前で指定可能な色一覧
-
16進法表記一覧
※下2つはColors in R 参照
また、googleでColor code pickerと検索すると選んだ色のコードが取得できるようです!