designBlocksGGPlot {dae}R Documentation

Adds block boundaries to a plot produced by designGGPlot.

Description

This function adds block boundaries to a plot produced by designGGPlot. It allows control of the starting unit, through originrow and origincolumn, and the number of rows (nrows) and columns (ncolumns) from the starting unit that the blocks to be plotted are to cover.

Usage

designBlocksGGPlot(ggplot.obj, blockdefinition = NULL, blocksequence = FALSE, 
                   originrow= 0, origincolumn = 0, nrows, ncolumns, 
                   blocklinecolour = "blue", blocklinesize = 2, 
                   facetstrips.placement = "inside", 
                   printPlot = TRUE)

Arguments

ggplot.obj

An object produced by ggplot.

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.

blocksequence

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

originrow

A numeric speccifying the row after which the plotting of block boundaries is to start.

origincolumn

A numeric speccifying the column after which the plotting of block boundaries is to start.

nrows

A numeric the number of rows (nrows), from the starting unit, that the blocks to be plotted are to cover.

ncolumns

A numeric the number of columns (ncolumns), from the starting unit, that the blocks to be plotted are to cover.

blocklinecolour

A character string specifying the colour of the block boundary.

See Colour specification under the par function.

blocklinesize

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

facetstrips.placement

A character nominating where the strip is to be placed with respect to axes text and titles, either "inside" both text and titles, "outside.text" or "outside.title". This argument is important only when axes and strips are on the same side of the plot. When this occurs, the default is to place them inside the axis text. Note: This argument must be specified only once in the constructon of the plot and after every other aspect of the plot has been finalized. In particular, if designBlocksGGPlot is to called after designGGPlot to add block boundaries, then facetstrips.placement should be specified in the last call to designBlocksGGPlot, not in the call to designGGPlot.

printPlot

A logical indicating whether to print the plot after adding the block boundaries.

Value

An object of class "ggplot", formed by adding to the input ggplot.obj and which can be plotted using print.

Author(s)

Chris Brien

Source

Brien, C.J., Harch, B.D., Correll, R.L., and Bailey, R.A. (2011) Multiphase experiments with at least one later laboratory phase. I. Orthogonal designs. Journal of Agricultural, Biological, and Environmental Statistics, 16:422-450.

See Also

designGGPlot, par, DiGGer

Examples

## Construct a randomized layout for the split-unit design described by 
## Brien et al. (2011, Section 5)
split.sys <- cbind(fac.gen(list(Months = 4, Athletes = 3, Tests = 3)),
                   fac.gen(list(Intensities = LETTERS[1:3], Surfaces = 3), 
                           times = 4))
split.lay <- designRandomize(allocated = split.sys[c("Intensities", "Surfaces")],
                             recipient = split.sys[c("Months", "Athletes", "Tests")], 
                             nested.recipients = list(Athletes = "Months", 
                                                      Tests = c("Months", "Athletes")),
                             seed = 2598)
## Plot the design
cell.colours <- c("lightblue","lightcoral","lightgoldenrod","lightgreen","lightgrey",
                  "lightpink","lightsalmon","lightcyan","lightyellow","lightseagreen")

split.lay <- within(split.lay, 
                    Treatments <- fac.combine(list(Intensities, Surfaces), 
                                              combine.levels = TRUE))
plt <- designGGPlot(split.lay, labels = "Treatments", 
                    row.factors = "Tests", column.factors = c("Months", "Athletes"),
                    colour.values = cell.colours[1:9], label.size = 6, 
                    blockdefinition = rbind(c(3,1)), blocklinecolour = "darkgreen",
                    printPlot = FALSE)
#Add Month boundaries
designBlocksGGPlot(plt, nrows = 3, ncolumns = 3, blockdefinition = rbind(c(3,3)))



#### A layout for a growth cabinet experiment that allows for edge effects
data(Cabinet1.des)
plt <- designGGPlot(Cabinet1.des, labels = "Combinations", cellalpha = 0.75,
                    title = "Lines and Harvests allocation for Cabinet 1", 
                    printPlot = FALSE)

## Plot Mainplot boundaries
plt <- designBlocksGGPlot(plt, blockdefinition = cbind(4,16), originrow= 1 , 
                          blocklinecolour = "green", nrows = 9, ncolumns = 16, 
                          printPlot = FALSE)
plt <- designBlocksGGPlot(plt, blockdefinition = cbind(1,4), 
                          blocklinecolour = "green", nrows = 1, ncolumns = 16, 
                          printPlot = FALSE)
plt <- designBlocksGGPlot(plt, blockdefinition = cbind(1,4), originrow= 9, 
                          blocklinecolour = "green", nrows = 10, ncolumns = 16, 
                          printPlot = FALSE)
## Plot all 4 block boundaries            
plt <- designBlocksGGPlot(plt, blockdefinition = cbind(8,5,5,4), blocksequence = TRUE, 
                          origincolumn = 1, originrow= 1, 
                          blocklinecolour = "blue", nrows = 9, ncolumns = 15, 
                          printPlot = FALSE)
plt <- designBlocksGGPlot(plt, blockdefinition = cbind(10,16), 
                          blocklinecolour = "blue", nrows = 10, ncolumns = 16, 
                          printPlot = FALSE)
## Plot border and internal block boundaries only
plt <- designBlocksGGPlot(plt, blockdefinition = cbind(8,14), origincolumn = 1, originrow= 1, 
                          blocklinecolour = "blue", nrows = 9, ncolumns = 15, 
                          printPlot = FALSE)
plt <- designBlocksGGPlot(plt, blockdefinition = cbind(10,16), 
                          blocklinecolour = "blue", nrows = 10, ncolumns = 16)

[Package dae version 3.2.25 Index]