draw_scalebar: Draws a scalebar for ST plots

draw_scalebarR Documentation

Draws a scalebar for ST plots

Description

Takes a ggplot object as input together with some additional parameters specifying the position and widht of a scalebar representing the actual width of corresponding 500um in the plot. The actual width of the scale bar is determined by the x, xend parameters and has to be calulated separately. To do this, you can use the pixels.per.um slot of the 'Staffli' object.

Usage

draw_scalebar(
  p,
  x = NULL,
  xend = NULL,
  y = NULL,
  pxum = NULL,
  sb.size = 2.5,
  dark.theme = FALSE
)

Arguments

p

An object of class 'ggplot'

x, xend

The start and positions of the scalebar along the x axis.

y

The position of the scalebar along the y axis.

pxum

A data.frame object with columns for 'x', 'xend', 'y' and 'sample' used for facetted plots.

sb.size

Size of scalebar

dark.theme

Switches color of scalebar to 'white'

Value

An object of class 'ggplot' with a scalebar drawn on top of it


jbergenstrahle/STUtility documentation built on March 14, 2023, 7:15 a.m.