designPlot: A graphical representation of an experimental design using...

designPlotR Documentation

A graphical representation of an experimental design using labels stored in a matrix.

Description

This function uses labels, usually derived from treatment and blocking factors from an experimental design and stored in a matrix, to build a graphical representation of the matrix, highlighting the position of certain labels . It is a modified version of the function supplied with DiGGer. It includes more control over the labelling of the rows and columns of the design and allows for more flexible plotting of designs with unequal block size.

Usage

designPlot(designMatrix, labels = NULL, altlabels = NULL, plotlabels = TRUE, 
           rtitle = NULL, ctitle = NULL, 
           rlabelsreverse = FALSE, clabelsreverse = FALSE, 
           font = 1, chardivisor = 2, rchardivisor = 1, cchardivisor = 1, 
           cellfillcolour = NA, plotcellboundary = TRUE, 
           rcellpropn = 1, ccellpropn = 1, 
           blocksequence = FALSE, blockdefinition = NULL, 
           blocklinecolour = 1, blocklinewidth = 2, 
           rotate = FALSE, new = TRUE, ...)

Arguments

designMatrix

A matrix containing a set of numerics or characters being the labels as they have been assigned to the cells of the grid represented by the matrix.

labels

A numeric or character vector giving the cells in designMatrix that are to be plotted in this call to designPlot. If NULL then all the cells are plotted.

What is actually plotted for a cell is controlled jointly by labels, plotlabels, altlabels, plotcellboundary and cellfillcolour. If plotlabels is TRUE and altlabels is NULL then labels are plotted in the cells, unless labels is NULL when the labels in designMatrix are plotted.

Whatever is being plotted, altlabels and cellfillcolour must have an appropriate number of values. See text for more information on specifying the labels.

altlabels

Either a character vector containing an alternative set of labels for the labels currently being plotted or a single integer specifying an alternative symbol to be used in plotting cells when plotlabels is TRUE. The length of altlabels must be one or the same length as labels, unless labels is NULL in which case it must equal the number of unique labels in designMatrix.

If altlabels is NULL, the labels specified in labels are plotted when plotlabels is TRUE. If labels is also NULL, the labels in designMatrix are plotted. See text for more information on specifying the labels.

plotlabels

A logical to indicate whether labels are to be plotted in the cells. If TRUE, print all labels or the specific labels listed in labels. If FALSE, no labels are printed in the cells.

rtitle

A character string to use as a title for rows of the plot. If rtitle is NULL then no title is plotted.

ctitle

A character string to use as a title for columns of the plot. If ctitle is NULL then no title is plotted.

rlabelsreverse

A logical indicating whether to reverse the row labels.

clabelsreverse

A logical indicating whether to reverse the column labels.

font

An integer specifying the font to be used for row and column labelling. See par for further details.

chardivisor

A numeric that changes the size of text and symbols in the cells by dividing the default size by it.

rchardivisor

A numeric that changes the size of the labels of the rows of the design by dividing the default size by it.

cchardivisor

A numeric that changes the size of the labels of the columns of the design by dividing the default size by it.

cellfillcolour

A character string specifying the colour of the fill for the cells to be plotted in this call. If there is only one colour then all cells being plotted with that colour. If there is more than one colour then, unless labels is NULL, the number of colours must at least equal the number of labels and then the fill colours will be matched, one for one from the first colour, with the labels. If labels is NULL then the number of colours must at least equal the number of unique labels in designMatrix. The default, NA, is to leave ther cells unfilled.

See also Colour specification under the par function.

plotcellboundary

A logical indicting whether a boundary is to plotted around a cell.

rcellpropn

a value between 0 and 1 giving the proportion of the standard row size of a cell size to be plotted as a cell.

ccellpropn

a value between 0 and 1 giving the proportion of the standard column size of a cell size to be plotted as a cell.

blocksequence

A logical that determines whether block numbers are repetitions or sequences of block numbers.

blockdefinition

A matrix of block sizes:

  • if there is only one row, then the first element is interpreted as the no. rows in each block and blocks with this number of rows are to be repeated across the rows of the design.

  • if there is more than one row, then each row of the matrix specifies a block, with the sequence of rows in the matrix specifying a corresponding sequence of blocks down the rows of the design.

Similarly, a single value for a column specifies a repetition of blocks of that size across the columns of the design, while several column values specifies a sequence of blocks across the columns of the size specified.

blocklinecolour

A character string specifying the colour of the block boundary.

See also Colour specification under the par function.

blocklinewidth

A numeric giving the width of the block boundary to be plotted.

rotate

A logical which, if TRUE, results in the matrix being rotated 90 degrees for plotting.

new

A logical indicating if a new plot is to be produced or the current plot is added to.

...

further arguments passed to polygon in plotting the cell.

Value

no values are returned, but a plot is produced.

Author(s)

Chris Brien

References

Coombes, N. E. (2009). DiGGer design search tool in R. http://nswdpibiom.org/austatgen/software/

See Also

blockboundaryPlot, designPlotlabels, designLatinSqrSys, designRandomize, designAnatomy in package dae.
Also, par, polygon, DiGGer

Examples

## Not run: 
  designPlot(des.mat, labels=1:4, cellfillcolour="lightblue", new=TRUE, 
             plotcellboundary = TRUE, chardivisor=3, 
             rtitle="Lanes", ctitle="Positions", 
             rcellpropn = 1, ccellpropn=1)
  designPlot(des.mat, labels=5:87, plotlabels=TRUE, cellfillcolour="grey", new=FALSE,
             plotcellboundary = TRUE, chardivisor=3)
  designPlot(des.mat, labels=88:434, plotlabels=TRUE, cellfillcolour="lightgreen", 
             new=FALSE, plotcellboundary = TRUE, chardivisor=3, 
             blocksequence=TRUE, blockdefinition=cbind(4,10,12), 
             blocklinewidth=3, blockcolour="blue")
## End(Not run)

dae documentation built on June 22, 2024, 9:07 a.m.