coord_plate: Plate coordinates

View source: R/coord_plate.R

coord_plateR Documentation

Plate coordinates

Description

This coordinate functions makes your plot look more like a microwell plate.

Usage

coord_plate(
  xlim = NULL,
  ylim = NULL,
  expand = TRUE,
  default = FALSE,
  clip = "off",
  corner = "right",
  specs = 96
)

Arguments

xlim

Limits for the x and y axes.

ylim

Limits for the x and y axes.

expand

If TRUE, the default, adds a small expansion factor to the limits to ensure that data and axes don't overlap. If FALSE, limits are taken exactly from the data or xlim/ylim.

default

Is this the default coordinate system? If FALSE (the default), then replacing this coordinate system with another one creates a message alerting the user that the coordinate system is being replaced. If TRUE, that warning is suppressed.

clip

Should drawing be clipped to the extent of the plot panel? A setting of "on" (the default) means yes, and a setting of "off" means no. In most cases, the default of "on" should not be changed, as setting clip = "off" can cause unexpected results. It allows drawing of data points anywhere on the plot, including in the plot margins. If limits are set via xlim and ylim and some data points fall outside those limits, then those data points may show up in places such as the axes, the legend, the plot title, or the plot margins.

corner

The place to draw the notched corner of a plate. Can be one of "left", "right", "top", "bottom", "topleft", "topright", "bottomleft", "bottomright", "none" or "all".

specs

Either a list with plate dimensions or a numeric(1) with one of the common formats, e.g. 6, 12, 24, 48, 96 or 384 wells.

Details

The panel.background theme element now draws a polygon instead of a rectangle in case corner != "none". Moreover, the panel.grid.major element is used to draw circles at well positions and panel.grid.minor is used to draw regular grid lines. Actual minor breaks are ignored.

The dimensions of most standard plates are roughly based on technical data sheets available on the Eppendorf website, a manufacturer of cell culture consumables.

Value

A Coord object that can be added to a plot.

Examples

# Make basic plot
df <- data.frame(x = 1:4, y = 1:4)

p <- ggplot(df, aes(x = x, y = y)) +
  geom_well()

# Using spec and limits to change layout
p + coord_plate(spec = 96, xlim = c(1, 12), ylim = c(1, 8))
p + coord_plate(spec = 48, xlim = c(1, 8), ylim = c(1, 6))

# Changing where the corner is placed
p + coord_plate(spec = 24, xlim = c(1, 6), ylim = c(1, 4),
                corner = "left")

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