Some varr
functions give the chance for the user to
change the colors of the graph trough the argument colors
.
This argument can have multiple specifications:
-
NULL
, for the default ggplot colors - A palette from a package, in the format
"pgk::palette_name"
- A vector of colors, as defined in the ggplot
specs vignette:
- A name, e.g.,
"red"
. R has 657 built-in named colours, which can be listed withcolours()
. - An rgb specification, with a string of the form
"#RRGGBB"
where each of the pairsRR
,GG
,BB
consists of two hexadecimal digits giving a value in the range00
toFF
. You can optionally make the colour transparent by using the form"#RRGGBBAA"
. - An NA, for a completely transparent colour.
- The munsell package, by Charlotte Wickham, makes it easy to choose specific colours using a system designed by Albert H. Munsell. If you invest a little in learning the system, it provides a convenient way of specifying aesthetically pleasing colours.
- A name, e.g.,
Suported packages and the possible palette_name
’s
are:
base | rainbow, heat.colors, terrain.colors, topo.colors, cm.colors |
viridis | viridis, magma, inferno, plasma, cividis, mako, rocket, turbo |
RColorBrewer | Blues, BuGn, BuPu, GnBu, Greens, Greys, Oranges, OrRd, PuBu, PuBuGn, PuRd, Purples, RdPu, Reds, YlGn, YlGnBu, YlOrBr, YlOrRd, Accent, Dark2, Paired, Pastel1, Pastel2, Set1, Set2, Set3, BrBG, PiYG, PRGn, PuOr, RdBu, RdGy, RdYlBu, RdYlGn, Spectral |
ggsci | pal_npg, pal_aaas, pal_nejm, pal_lancet, pal_jama, pal_jco, pal_ucscgb, pal_d3, pal_locuszoom, pal_igv, pal_cosmic, pal_uchicago, pal_startrek, pal_tron, pal_futurama, pal_rickandmorty, pal_simpsons, pal_flatui, pal_frontiers, pal_gsea, pal_material |