plotColourMat: Plot a matrix of colors

Description Usage Arguments Details Value Author(s) Examples

Description

Plot a character matrix giving the colours to plot.

Usage

1
plotColourMat(x, add = FALSE, ...)

Arguments

x

A character matrix of colour names.

add

logical. Should the matrix be added to the current plot device.

...

Arguments passed to rect.

Details

The colours are plotted as squares as given by x on the grid of integers. The entry given in x[i,j] is plotted as a rectangle at coordinate (i, nrow(x)-j).

Value

Invisibly returns the x and y coordinates and the corresponding colours.

Author(s)

Anders Ellern Bilgrau <anders.ellern.bilgrau (at) gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
plotColourMat()  # Plots a random 6 by 10 colour matrix.

x <- matrix(sample(colors(), 20), ncol = 5)
plotColourMat(x)

x <- matrix(rainbow(100), 1, 100)
plotColourMat(x)
dim(x) <- c(10, 10)
plotColourMat(x)

y <- matrix(sample(colors(), 25), ncol = 5)  
plotColourMat(y, add = TRUE)
axis(1)
axis(2)

AEBilgrau/Bmisc documentation built on May 5, 2019, 11:28 a.m.