Object Oriented Microarray Library: Colors

The colors package defines two classes, color.coding and color.coded.pair, and several symbolic names for color values. See the bottom of the page for an example of how the classes can be used.

Class Name: color.coding

Attributes

v
A logical vector.
color
A scalar, representing a color as used by the col option of the plot command.
mark
An optional scalar, representing a plotting symbol as used by the pch option of the plot command. The default value is 1.

Methods

is.color.coding(object)
This method returns a logical value that tells you if the object passed into the routine is of a class derived from the color.coding class.

Description

An object of the color.coding class consists of a logical vector v and a scalar color. The idea is that this information will be used to display some other pair of vectors in a particular color. The color scalar will be passed to the col option in a plot command, and points for which the logical vector is true will be plotted in the associated color.

Class Name: color.coded.pair

Attributes

x
A vector of values for the independent variable.
y
A vector of values for the dependent variable.
ccl
A list containing objects of the color.coding class.

Methods

plot(object, ...)
This method produces a colorful plot of y as function of x. The standard optional arguments to the plot routine can be used (but the ones that affect color should probably be avoided).

Description

An object of the color.coded.pair class represents a plottable two-dimensional object (given by the vectors x and y) along with a list, ccl, of color.coding information. The plot routine for a color.coded.pair produces a scatter plot with specified points colored according to the scheme specified by the color.coded.pair objects. By passing around lists of color.coded.pair objects, we can ensure that related points on distinct graphs are colored consistently.

Color Values

The package also defines symbolic names for certain color values to help ensure that a consistent color-code is used throughout a project. Currently, the list of defined colors is:

Example

  theta <- (0:360)*pi/180
  x <- cos(theta)
  y <- sin(theta)
  xp <- x > 0
  yp <- y > 0
  colors <- list(color.coding(xp&yp, 2),
	color.coding(xp&!yp, 4),
	color.coding(!xp&yp, 6),
	color.coding(!xp&!yp, 8))
  plot(color.coded.pair(x, y, colors))
  plot(color.coded.pair(theta, x, colors))
  plot(color.coded.pair(theta, y, colors),
	xlab='angle in radians', ylab='sine', main='colored sine')