ggplateplot: Plate plots

View source: R/ggplateplot.R

ggplateplotR Documentation

Plate plots

Description

This function is a wrapper for ggplot(), that tries to automatically guess an appropriate shape for a microwell layout based on the data.

Usage

ggplateplot(data = NULL, mapping = aes(), ..., environment = parent.frame())

Arguments

data

Default dataset to use for plot. If not already a data.frame, will be converted to one by fortify(). If not specified, must be supplied in each layer added to the plot.

mapping

Default list of aesthetic mappings to use for plot. If not specified, must be supplied in each layer added to the plot.

...

Other arguments passed on to methods. Not currently used.

environment

DEPRECATED. Used prior to tidy evaluation.

Details

The 'guessing' part happens by looking at the number of observations if the data argument is a data.frame, and the first two dimensions if the data argument is a matrix or array. If it does not guess the appropriate shape correctly, it might be easier to use ggplot() + ... + coord_shape(spec = ...) directly.

If the data argument is an array or matrix, this is converted to a long format data.frame and the x and y aesthetics are populated by the first two dimensions of the data argument.

Value

A ggplot object.

Examples

# With long-format data
df <- expand.grid(LETTERS[1:2], 1:3)
df$value <- seq_len(nrow(df))

ggplateplot(df, aes(Var2, Var1, fill = factor(value))) +
  geom_well()

# With matrices/arrays, cell values become the 'value' column
m <- matrix(1:12, nrow = 3, ncol = 4)

ggplateplot(m, aes(fill = factor(value))) +
  geom_well()

teunbrand/ggplateplot documentation built on May 8, 2022, 1:06 a.m.