デフォルトのカラーセットを使ってもよいのだが、適当な色を持ってきたい。
Rには色見本がある。
mikuhatsune.hatenadiary.com
このなかで、暗色系の色を適当にもってきてプロットに使いたい、と思ったらほげほげ4 というのがだいたい暗色系統なので、正規表現を使って末尾が4の色を取得すればよい。
stringr::str_subset(colors(), "4$")
[1] "antiquewhite4" "aquamarine4" "azure4" "bisque4" "blue4"
[6] "brown4" "burlywood4" "cadetblue4" "chartreuse4" "chocolate4"
[11] "coral4" "cornsilk4" "cyan4" "darkgoldenrod4" "darkolivegreen4"
[16] "darkorange4" "darkorchid4" "darkseagreen4" "darkslategray4" "deeppink4"
[21] "deepskyblue4" "dodgerblue4" "firebrick4" "gold4" "goldenrod4"
[26] "gray4" "gray14" "gray24" "gray34" "gray44"
[31] "gray54" "gray64" "gray74" "gray84" "gray94"
[36] "green4" "grey4" "grey14" "grey24" "grey34"
[41] "grey44" "grey54" "grey64" "grey74" "grey84"
[46] "grey94" "honeydew4" "hotpink4" "indianred4" "ivory4"
[51] "khaki4" "lavenderblush4" "lemonchiffon4" "lightblue4" "lightcyan4"
[56] "lightgoldenrod4" "lightpink4" "lightsalmon4" "lightskyblue4" "lightsteelblue4"
[61] "lightyellow4" "magenta4" "maroon4" "mediumorchid4" "mediumpurple4"
[66] "mistyrose4" "navajowhite4" "olivedrab4" "orange4" "orangered4"
[71] "orchid4" "palegreen4" "paleturquoise4" "palevioletred4" "peachpuff4"
[76] "pink4" "plum4" "purple4" "red4" "rosybrown4"
[81] "royalblue4" "salmon4" "seagreen4" "seashell4" "sienna4"
[86] "skyblue4" "slateblue4" "slategray4" "snow4" "springgreen4"
[91] "steelblue4" "tan4" "thistle4" "tomato4" "turquoise4"
[96] "violetred4" "wheat4" "yellow4"
あとはsample
関数などでも使えば適当なカラーセットができる。