radial_plot {opm}R Documentation

Radial plot

Description

A wrapper for radial.plot from the plotrix package with some adaptations likely to be useful for OmniLog(R) data.

Usage

  ## S4 method for signature 'MOPMX'
radial_plot(object, ...) 
  ## S4 method for signature 'OPMS'
radial_plot(object, as.labels,
    subset = opm_opt("curve.param"), sep = " ", extract.args = list(), ...) 
  ## S4 method for signature 'data.frame'
radial_plot(object, as.labels,
    subset = "numeric", sep = " ", extract.args = list(), ...) 
  ## S4 method for signature 'matrix'
radial_plot(object, as.labels = NULL,
    subset = TRUE, sep = " ", extract.args = list(), rp.type = "p",
    radlab = FALSE, show.centroid = TRUE, show.grid.labels = 1, lwd = 3,
    mar = c(2, 2, 2, 2), line.col = opm_opt("colors"), draw.legend = TRUE,
    x = "bottom", y = NULL, xpd = TRUE, pch = 15, legend.args = list(),
    group.col = FALSE, point.symbols = 15, point.col = opm_opt("colors"),
    poly.col = NA, main = paste0(as.labels, sep = sep), ...) 

Arguments

object

OPMS or MOPMX object (with aggregated values) to be plotted. Alternatively a data frame or a numeric matrix, but the methods for these objects are rarely needed.

as.labels

For the OPMS method, a metadata selection defining the data to be joined and used as row names, ultimately yielding the legend. If NULL or empty, ignored. See extract for details. For the data-frame method, a selection of columns used in the same way.

subset

For the OPMS method, a character scalar passed to the OPMS method of extract. The data-frame method uses this to select the columns; currently only the default makes sense. For the matrix method, a selection of columns to be plotted.

sep

Character scalar determining how to join row names. See extract for details.

extract.args

Optional list of arguments passed to the OPMS method of extract. Currently ignored by the other methods.

rp.type

Character scalar. Among the possible values ‘p’ for polygons, ‘s’ for symbols and ‘r’ for radial lines, the latter is not recommended. These and the following arguments are passed to plotrix::radial.plot. See there for details.

radlab

Logical scalar. Rotation of the outer labels to a radial orientation might safe some space in the graphic.

show.centroid

Logical scalar.

show.grid.labels

Logical scalar. Indicates whether and where display labels for the grid are shown.

lwd

Numeric scalar for the line width.

mar

Numeric vector of length 4 determining the margins of the plot.

line.col

Character or numeric vector for determining the line colour.

point.symbols

Like the following arguments, passed to radial.plot from the plotrix package. See there for details. Explicitly provided here to silence some radial.plot warnings occurring as of R 3.0.0.

point.col

Indicates the colour(s) of the symbols.

poly.col

Indicates the colour for filling the drawn polygons, if any. Use NA for no fill (recommended).

group.col

Logical scalar indicating whether or not wells from plates that belong to the same group shall have the same colour.

main

The main title of the plot.

...

Optional other arguments passed to radial.plot from the plotrix package or between the methods.

draw.legend

Logical scalar. Whether to draw a legend. Ignored unless object has row names (because these are used to generate the description).

x

Legend position, passed to legend from the graphics package. Ignored unless draw.legend is TRUE.

y

Optional Second legend coordinate. Also passed to that function.

xpd

Logical scalar. Also passed to that function.

pch

Integer scalar. Also passed to that function.

legend.args

List of optional other arguments passed to that function.

Details

The default positioning of the legend is not necessarily very useful, but suitable combinations of margin, x and y can be found for given data sizes. Plotting entire plates usually makes not much sense (see the examples).

The data frame and OPMS methods extract a numeric matrix from a given data frame or OPMS object and pass the result to the matrix method.

Value

A vector with the row names of object as names and the corresponding colours as values, equivalent to the legend; NULL if no row names are present. A list of such objects in the case of the MOPMX method.

Author(s)

Lea A.I. Vaas and Markus Goeker

See Also

plotrix::radial.plot graphics::legend

Other plotting-functions: ci_plot, heat_map, level_plot, parallel_plot, parallelplot, summary, xy_plot

Examples

data("vaas_4")

## 'OPMS' method
# Note that this visualization is not useful when applied to too many wells.
# Thus, we here use only a subset of the wells for plotting.
(y <- radial_plot(vaas_4[, , 1:5], as.labels = list("Species", "Strain"),
  main = "Test", x = 200, y = 200))

plot of chunk unnamed-chunk-1

##      Escherichia coli DSM18039     Escherichia coli DSM30083T 
##                      "#008080"                      "#800080" 
## Pseudomonas aeruginosa DSM1707  Pseudomonas aeruginosa 429SC1 
##                      "#808000"                      "#000000"
# with some fine tuning; note the centroids
(y <-radial_plot(vaas_4[, , 1:5], as.labels = list("Species", "Strain"),
  main = "Test", x = 200, y = 200, rp.type = "s", show.centroid = TRUE))

plot of chunk unnamed-chunk-1

##      Escherichia coli DSM18039     Escherichia coli DSM30083T 
##                      "#008080"                      "#800080" 
## Pseudomonas aeruginosa DSM1707  Pseudomonas aeruginosa 429SC1 
##                      "#808000"                      "#000000"
# with the same colour for members of the same group
(xy <-radial_plot(vaas_4[, , 1:5], as.labels = list("Species"),
  group.col = TRUE, main = "Test", x = 200, y = 200, rp.type = "s",
  show.centroid = TRUE))
## Warning in .local(object, ...): duplicated label: Escherichia coli

plot of chunk unnamed-chunk-1

##       Escherichia coli Pseudomonas aeruginosa 
##              "#008080"              "#800080"
## Data-frame method (rarely needed)
x <- extract(vaas_4, as.labels = list("Species", "Strain"), dataframe = TRUE)
(yy <- radial_plot(x[, 1:8], as.labels = c("Species", "Strain"),
  main = "Test"))

plot of chunk unnamed-chunk-1

##      Escherichia coli DSM18039     Escherichia coli DSM30083T 
##                      "#008080"                      "#800080" 
## Pseudomonas aeruginosa DSM1707  Pseudomonas aeruginosa 429SC1 
##                      "#808000"                      "#000000"
stopifnot(identical(y, yy)) # should also yield the same picture than above
stopifnot(is.character(yy), names(yy) == paste(x$Species, x$Strain))

## Matrix method (rarely needed)
x <- extract(vaas_4, as.labels = list("Species", "Strain"))
(yy <- radial_plot(x[, 1:5], main = "Test"))
##      Escherichia coli DSM18039     Escherichia coli DSM30083T 
##                      "#008080"                      "#800080" 
## Pseudomonas aeruginosa DSM1707  Pseudomonas aeruginosa 429SC1 
##                      "#808000"                      "#000000"
stopifnot(identical(y, yy)) # should also yield the same picture than above
stopifnot(is.character(yy), names(yy) == rownames(x))

[Package opm version 1.3.63 Index]