new_plate_spec: Define a new plate layout

View source: R/specs_plates.R

new_plate_specR Documentation

Define a new plate layout

Description

The new_plate_spec() function is used to define the specification of a plate layout. The custom_plate_spec() is a wrapper around new_plate_spec() that heuristically sets dimensions for quick and dirty layouts.

Usage

new_plate_spec(
  width = 127.8,
  height = 85.5,
  hor_spacing = NULL,
  ver_spacing = NULL,
  well_spacing = 9,
  well_diameter = 6.8,
  corner_size = 8,
  ncol = 12L,
  nrow = 8L
)

custom_plate_spec(ncol = 12L, nrow = 8L, width = 127.8, height = 85.5)

Arguments

width

Width of the plate in millimetres.

height

Height of the plate in millimetres.

hor_spacing

Horizontal spacing between wells in millimetres. If NULL (default), the well_spacing argument will be used instead.

ver_spacing

Vertical spacing between wells in millimetres. If NULL (default), the well_spacing argument will be used instead.

well_spacing

Spacing between wells in millimetres. Useful when horizontal and vertical spacing is identical.

well_diameter

Diameter of a well in millimetres.

corner_size

Size of the adjacent/opposite sides of the triangle, in millimeters, when plate has a corner cut off.

ncol

The number of wells in horizontal direction.

nrow

The number of wells in vertical direction.

Value

A list with dimensions that can be understood by the specs argument in coord_plate().

Examples

# Precisely detail a new layout
rotated_96well <- new_plate_spec(
  width         = 85.5,
  height        = 127.8,
  well_spacing  = 9,
  well_diameter = 6.8,
  ncol          = 8,
  nrow          = 12
)

## Setup dummy data
df <- expand.grid(row = 1:12, col = LETTERS[1:8])
df$value <- seq_len(nrow(df))

## Use new spec in plot
ggplot(df, aes(col, row, fill = value)) +
  geom_well() +
  coord_plate(spec = rotated_96well)

# Quickly sketch a new layout
square_2x2 <- custom_plate_spec(ncol = 2, nrow = 2, width = 100, height = 100)

## Setup dummy data
df <- expand.grid(row = 1:2, col = LETTERS[1:2])
df$value <- seq_len(nrow(df))

## Use spec in plot
ggplot(df, aes(col, row, fill = value)) +
  geom_well() +
  coord_plate(spec = square_2x2)

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