Lines Matching refs:palette

1 % File src/library/grDevices/man/palette.Rd
6 \name{palette}
7 \alias{palette}
8 \alias{palette.pals}
9 \alias{palette.colors}
12 palette(value)
13 palette.pals()
14 palette.colors(n = NULL, palette = "Okabe-Ito", alpha, recycle = FALSE)
17 \item{value}{an optional character vector specifying a new palette
19 \item{n}{the number of colors to select from a palette. The default
20 \code{\link{NULL}} selects all colors of the given palette.}
21 \item{palette}{a valid palette name (one of \code{palette.pals()}).
27 length(palette(.))}. By default (\code{recycle = FALSE}), the
31 View or manipulate the color palette which is used when \code{col=}
35 The \code{palette()} function gets or sets the current palette,
36 the \code{palette.pals()} function lists the available predefined
37 palettes, and the \code{palette.colors()} function
40 The color palette and referring to colors by number (see
45 color palette. The available palette names are returned by
46 \code{palette.pals()}. It is also possible to specify \code{"default"}.
49 description of the colors which are to make up the new palette.
50 The maximum size for a palette is 1024
53 If \code{value} is omitted, no change is made to the current palette.
55 There is only one palette setting for all devices in an \R session. If
56 the palette is changed, the new palette applies to all subsequent
59 The current palette also applies to re-plotting (for example if an
61 \code{\link{replayPlot}} is used). The palette is recorded on the
66 \code{palette()} returns a character vector giving the colors from the
67 palette which \emph{was} in effect.
70 \code{palette.pals()} returns a character vector giving the names
73 \code{palette.colors()} returns a vector of R colors.
87 palette() # obtain the current palette
88 palette("R3");palette() # old default palette
89 palette("ggplot2") # ggplot2-style palette
90 palette()
92 palette(hcl.colors(8, "viridis"))
94 (palette(gray(seq(0,.9,length.out = 25)))) # gray scales; print old palette
97 sub = "palette(gray(seq(0, .9, len=25)))")
98 palette("default") # reset back to the default
101 ## use 'alpha = 0.3' transparency with the default palette :
102 mycols <- adjustcolor(palette(), alpha.f = 0.3)
103 opal <- palette(mycols)
109 palette("default")
112 palette.pals()
123 sinplot("default palette")
125 palette("R3"); sinplot("R3")
126 palette("Okabe-Ito"); sinplot("Okabe-Ito")
127 palette("Tableau") ; sinplot("Tableau")
128 palette("default") # reset
130 ## color swatches for palette.colors()
131 palette.swatch <- function(palette = palette.pals(), n = 8, nrow = 8,
134 cols <- sapply(palette, palette.colors, n = n, recycle = TRUE)
141 while (length(palette)) {
146 text(0, y + 0.1, palette[subset], adj = c(0, 0))
150 palette <- palette[-subset]
155 palette.swatch()
157 palette.swatch(n = 26) # show full "Alphabet"; recycle most others