palette.viewers {Polychrome}R Documentation

Visualizing Color Palettes

Description

Functions that provide visualization of palettes to help determine appropriate contexts where thay can be used.

Usage

rancurves(colorset, ...)
ranpoints(colorset, N=10, ...)
swatch(colorset, main=deparse(substitute(colorset)))
swatchHue(colorset, main=paste(deparse(substitute(colorset)),
                           ", by Hue", sep=""))
swatchLuminance(colorset, main=paste(deparse(substitute(colorset)),
                           ", by Luminance", sep=""))
ranswatch(colorset, main=deparse(substitute(colorset)))
uvscatter(colorset, main=deparse(substitute(colorset)), ...)
luminance(colorset, main=deparse(substitute(colorset)), ...)
plothc(colorset, main=deparse(substitute(colorset)), ...)
plotpc(colorset, main=deparse(substitute(colorset)), ...)
p3d(colorset, main=deparse(substitute(colorset)), ...)

Arguments

colorset

a character vector containing hexadecimal color values.

main

a character string, the main title for a plot

N

an integer; the number of points to plot in each color.

...

additional graphical parameters.

Details

Different palettes are useful in different contexts. For example, high luminance colors may work well in barplots but provide low contrast when used to color points in scatter plots. The best way to decide if a palette is right for any particular application is probably to create a sample plot using the palette. The functions described here provide sample plots that display colors.

The function rancurves produces a set of sine curves with different phases and amplitudes, with each curve shown in a different color. The function ranpts produces a scatter plot showing N clustered points in each of the palette colors.

There are four functions that use barplots to display the palette. The simplest one, swatch, simply produces one bar of height one for each color, in the order that they are listed in the palette. The next two, swatchHue and swatchLuminance, first sort the palette (by hue or by luminance, respectively), before producing the barplot. The goal of these functions is to make sure that similar colors can be distinguished by placing them close together. The final function, ranswatch, randomly sorts the colors, to help decide if similar colors are identifiable when they are relatively far apart.

The p3d function plots the palette colors as spheres in three-dimensional CIE L*u*v* color space. It has been shown that perceptual distance is closely related to Euclidean distance in L*u*v* space. The uvscatter function produces a scatter plot of the palette colors using their projected u-v coordinates. The luminance function sorts the colors by luminance and produces a scatter plot showing the luminance.

The plothc function performs hierarchical clustering on the colors (using Euclidan distance in CIE L*u*v* color space and Ward's linkage) and displays the resulting dendrogram. The plotpc function uses the same distance metric to compute and plot principal components.

Value

In general, these functions are used for their side-effect (producing plots) rather than for their return values. In most cases, they invisibly return the color set with which they were invoked. The barplot-based functions (swatch, ranswatch, swatchHue, and swatchLuminance), however, return the vector of bar-centers, which can be used to add other information to the plot. The plothc function returns the dendrogram, and the plotpc function returns the principal components object.

Author(s)

Kevin R. Coombes <krc@silicovore.com>

See Also

palette36.colors

Examples

data(alphabet)
rancurves(alphabet)
ranpoints(alphabet)
uvscatter(alphabet)
luminance(alphabet)
plothc(alphabet)
p3d(alphabet, cex.symbols = 2)
swatch(alphabet)
swatchHue(alphabet)
swatchLuminance(alphabet)
ranswatch(alphabet)

[Package Polychrome version 1.5.1 Index]