plotParallel.Color: Plots the column vectors in the colorspace matrix versus the...

Description Usage Arguments Value Author(s) See Also Examples

Description

Plots the column vectors in the colorspace matrix versus the index.

Usage

1
2
## S3 method for class 'Color'
plotParallel(this, index=seq(this), xlab="index", ylab=paste(colnames(this), collapse = ", "), col=getColors(this)[index], transpose=FALSE, ...)

Arguments

index

integer vector specifying the order the color vectors should be plotted.

xlab,ylab

The labels on the x and the axis.

transpose

If TRUE, the colorspace matrix is transposed before passed to plot. This is makes it convenient to specify plot attributes such as col or pch for either each unique color or each color vector (column vector in the color space).

...

Other arguments accepted by plot.

Value

Returns nothing.

Author(s)

Henrik Bengtsson (http://www.braju.com/R/)

See Also

For more information see Color.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  x <- 0:100/100
  ch1 <- (sin(x*2*pi) + 1)/2
  ch2 <- (cos(x*2*pi) + 1)/2
  rg <- TwoChannelMicroarrayColor(ch1, ch2, maxColorValue=1)
  layout(matrix(1:2))
  plotParallel(rg)
  plotParallel(rg, col=c("red", "green"), transpose=TRUE)

  # One-dimensional colors
ncolors <- 256
x <- seq(0,1, length=ncolors)
ch1 <- x
ch2 <- rev(x)

colors <- list(
  # One-dimensional colors
  red      = RedColor(x),
  green    = GreenColor(x),
  blue     = BlueColor(x),
  gray     = GrayColor(x),
  spectrum = WavelengthColor(seq(380,779,length=ncolors)),
  heat     = HeatColor(x),
  rainbow  = RainbowColor(x),
  topo     = TopologyColor(x),
  terrain  = TerrainColor(x),
  cm       = CyanMagentaColor(x),

  # Two-dimensional colors
  rg = TwoChannelMicroarrayColor(ch1,ch2, maxColorValue=1),
  yb = TwoChannelMicroarrayColor(ch1,ch2, hueRange=c(HsvgColor$YELLOW.HUE,HsvgColor$BLUE.HUE), maxColorValue=1),
 
  # Three-dimensional colors
  rgb  = RgbColor(x,rev(x),sample(x)),
  hcl  = HclColor(x),

  # Four-dimensional colors
  hsvg = HsvgColor(x),
  cmyk = CmykColor(x,sample(x),rev(x),x/2)
)

layout(matrix(1:16, ncol=4, byrow=TRUE))
opar <- par(mar=c(0,1,3,1)+0.5)

for(color in colors)
  plotParallel(RgbColor(color))

par(opar)

HenrikBengtsson/R.colors documentation built on May 6, 2019, 11:53 p.m.