Description Usage Arguments Value Base palette, in default ordering Palette characteristics Palette ordering Palette subsets Examples
unipalette()
produces qualitative palettes based on a preset 7-color palette optimized for
lines, points, bars, etc, on a white background.
1 | unipalette(colors = NULL, order = "difference")
|
colors |
Integer vector or character vector. |
order |
Character. |
character vector. A vector of named RGB colors specified as hex color codes (#RRGGBB).
#'
red | lightblue | black | green | purple | pink | blue |
"#a11c3e" | "#5798d1" | "#252525" | "#319045" | "#5e2b7b" | "#e2908c" | "#226e83" |
designed for high contrast against a white background, with good distinction among colors
colors distinguishable under two most common forms of colorblindness
colors distinguishable in greyscale for b/w printing
Good for bar charts, box plots, pies, etc.
Line should be relatively thick
Points should be relatively large
The default ordering (order="difference"
) maximizes differences in hue and lightness between adjacent
colors. This aids discrimination of data plotted side by side, and also helps avoid implications
that the data is ordinal.
Two alternate orderings are also provided.
unipalette(order="lightness")
orders the color by increasing perceived lightness:
black purple red blue green lightblue pink
unipalette(order="hybrid")
increases the pairwise lightness difference in an otherwise
lightness-ordered palette:
black red purple green blue pink lightblue
unipalette(4)
returns the first 4 colors of the default ordering.
unipalette(2:5)
returns the colors 2 through 5 of the default ordering.
unipalette(c("red","lightblue","purple"))
returns the named colors in the order given.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## 3 orderings:
difference <- unipalette(); colorbar(difference,dots=TRUE)
lightness <- unipalette(order="lightness"); colorbar(lightness,dots=TRUE)
hybrid <- unipalette(order="hybrid"); colorbar(hybrid,dots=TRUE)
## subsets
subset <- unipalette(4); colorbar(subset,dots=TRUE)
## Sample plot
randomseries <- data.frame(x=1:4, y=runif(4*7), grp=rep(letters[1:7],each=4))
pal <- unipalette()
lattice::xyplot(y~x, group=grp, data=randomseries, type="b", pch=16, lwd=3, col = pal,
key = list(space = "right", text=list(letters[1:7], lines = list(col=pal, lwd=3)))
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.