Set or Retrieve car Package Color Palette
carPalette.RdThis function is used to set or retrieve colors to be used in car package graphics functions.
Arguments
- palette
if missing, returns the colors that will be used in car graphics; if present, the colors to be used in graphics will be set. The
paletteargument may also be one of"car"or"default"to use the default car palette (defined below),"R"to use the default R palette, or"colorblind"to use a colorblind-friendly palette (from https://jfly.uni-koeln.de/color/).
Details
This function sets or returns the value of options(carPalette=pallete) that will be use in car graphics functions to determine colors. The default is c("black", "blue", "magenta", "cyan", "orange", "gray", "green3", "red")), which is nearly a permutation of the colors returned by the standard palette function that minimizes the use of red and green in the same graph, and that substitutes orange for the often hard to see yellow.
References
Fox, J. and Weisberg, S. (2019) An R Companion to Applied Regression, Third Edition, Sage.
Examples
# Standard color palette
palette()
#> [1] "black" "#DF536B" "#61D04F" "#2297E6" "#28E2E5" "#CD0BBC" "#F5C710"
#> [8] "gray62"
# car standard color palette
carPalette()
#> [1] "black" "blue" "magenta" "cyan" "orange" "gray" "green3"
#> [8] "red"
# set colors to all black
carPalette(rep("black", 8))
# Use a custom color palette with 12 distinct colors
carPalette(sample(colors(distinct=TRUE), 12))
# restore default
carPalette("default")