florets: Draw coxcomb plots as points in a graphics window

View source: R/florets.R

floretsR Documentation

Draw coxcomb plots as points in a graphics window

Description

Draws a scatterplot where each point is a circular barplot, intended to show decon results

Usage

florets(
  x,
  y,
  b,
  col = NULL,
  legendwindow = FALSE,
  rescale.by.sqrt = TRUE,
  border = NA,
  add = FALSE,
  cex = 1,
  bty = "n",
  xaxt = "n",
  yaxt = "n",
  xlab = "",
  ylab = "",
  ...
)

Arguments

x

Vector of x coordinates

y

Vector of y coordinates

b

matrix or cell abundances, with columns aligned with the elements of x and y

col

vector of colors, aligned to the rows of b.

legendwindow

Logical. If TRUE, the function draws a color legend in a new window

rescale.by.sqrt

Logical, for whether to rescale b by its square root to make value proportional to shape area, not shape length.

border

Color of pie segment border, defauls to NA/none

add

Logical. If TRUE, the function draws florets atop an existing graphics device (TRUE) or call a new device (FALSE).

cex

Floret size. Florets are scaled relative to the range of x and y; this further scales up or down.

bty

bty argument passed to plot()

xaxt

xaxt argument passed to plot()

yaxt

yaxt argument passed to plot()

xlab

xlab, defaults to ""

ylab

ylab, defaults to ""

...

additional arguments passed to plot()

Value

Draws a coxcomb plot, returns no data.

Examples

data(mini_geomx_dataset)
data(safeTME)
# estimate background:
mini_geomx_dataset$bg <- derive_GeoMx_background(
  norm = mini_geomx_dataset$normalized,
  probepool = rep(1, nrow(mini_geomx_dataset$normalized)),
  negnames = "NegProbe"
)
# run basic decon:
res0 <- spatialdecon(
  norm = mini_geomx_dataset$normalized,
  bg = mini_geomx_dataset$bg,
  X = safeTME
)
# draw florets:
florets(
  x = mini_geomx_dataset$annot$x,
  y = mini_geomx_dataset$annot$y,
  b = res0$beta, cex = 2
)

Nanostring-Biostats/SpatialDecon documentation built on Jan. 26, 2024, 8:20 p.m.