colorQual: Assign colors to nominal values

Description Usage Arguments Value Author(s) Examples

Description

Associates nominal values with a set of colors.

Usage

1
colorQual(x, classes, colors, warn = TRUE, NAcolor = "transparent")

Arguments

x

Vector of character strings.

classes

Vector of character strings defining the class names. Typically, this would be unique(x).

colors

Vector of colors corresponding to classes.

warn

Warn if x contains elements not present in classes?

NAcolor

Color used for x values not present in classes.

Value

A vector of colors of the same length as x.

Author(s)

David Kneis david.kneis@tu-dresden.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
classes=c("A","B","C")
colors=c("red","blue","green")
x= runif(1000) * 100
y= runif(length(x)) * 100
z= rep("A", length(x))
z[x*y > 50] = "B"
z[x*y > 500] = "C"
z[x*y > 5000] = "D"
plot(x, y, col=colorQual(z, classes, colors, NAcolor="grey"))
legend("topright", bg="white", pch=1, col=colors, legend=classes)

dkneis/diatools documentation built on May 15, 2019, 9:12 a.m.