stsPlotSummaryProfiles: stsPlotSummaryProfiles

stsPlotSummaryProfilesR Documentation

stsPlotSummaryProfiles

Description

stsPlotSummaryProfiles

Usage

stsPlotSummaryProfiles(
  profile_dt,
  position_dt,
  x_points,
  y_points = x_points,
  x_var = "x",
  y_var = "y",
  extra_vars = character(),
  id_var = "id",
  wide_var = "name",
  tall_var = "tall_none",
  q_tall_values = NULL,
  q_wide_values = NULL,
  xrng = NULL,
  yrng = NULL,
  plot_type = c("glyph", "raster")[1],
  rname = NULL,
  odir = NULL,
  force_rewrite = FALSE,
  n_cores = getOption("mc.cores", 1),
  apply_norm = TRUE,
  ylim = c(0, 1),
  ma_size = 2,
  n_splines = 10,
  p = NULL,
  facet_byCell = FALSE,
  line_color_mapping = NULL,
  vertical_facet_mapping = NULL,
  N_floor = 0,
  N_ceiling = NULL,
  min_size = 0.3,
  return_data = FALSE
)

Arguments

profile_dt

a tidy data.table for profile data as retrieved by stsFetchTsneInput. Expected variable names are id, tall_var, wide_var, x, and y.

position_dt

a tidy data.table containing t-sne embedding. Expected variable names are tx, ty, id, and tall_var.

x_points

numeric. number of grid points to use in x dimension.

y_points

numeric. number of grid points to use in y dimension. Defaults to same value as x_points.

xrng

view domain in x dimension, default is range of position_dt$tx.

yrng

view domain in y dimension, default is range of position_dt$ty.

plot_type

character, must be one of "glyph" or "raster". raster uses ggimage::geom_image to embed images where glyph uses GGally::glyphs

rname

prefix for image files. existing image files are used if present.

odir

output directory for image files.

force_rewrite

if TRUE, images are overwritten even if they exist.

n_cores

number of cores to use when writing images. Default is value of mc.cores option if set or 1.

apply_norm

if TRUE, y values are trimmed to 95th percentile and transformed ot domain of [0,1]. Default is TRUE.

ylim

y-limits of regional summary plots. Default of c(0, 1) is compatible with apply_norm = TRUE.

ma_size

moving average size when smoothing profiles.

n_splines

number of points to interpolate with splines.

p

an existing ggplot to overlay images onto. Default of NULL starts a new plot.

facet_byCell

boolean. If TRUE, plots are facetted by tall_var.

line_color_mapping

named vector of line color. Names correspond to values of profile_dt 'wide_var' variable and values are colors.

vertical_facet_mapping

named vector of groups. vertical_facet_mapping names are wide_vars and order of first occurence determines vertical position top to bottom.

N_floor

The value of N to consider 0. bins with N values <= N_floor will be ignored.

N_ceiling

The value of N to consider 1. bins with N values >= N_ceiling will have images drawn at full size.

min_size

Numeric (0, 1]. The minimum size images to draw. The default of .3 draws images for all bins with N values >= 30 N_floor to N_ceiling.

return_data

if TRUE, data.table that would have been used to create ggplot is returned instead.

q_tall_vars

character vector of tall_vars to plot. Default of NULL plots all.

q_wide_vars

character vector of wide_vars to plot. Default of NULL plots all.

Value

returns a ggplot containing images summarizing t-sne space at resolution determined by x_points and y_points with the space density mapped to size.

Examples

data("profile_dt")
data("tsne_dt")
stsPlotSummaryProfiles(profile_dt, tsne_dt, x_points = 4)

jrboyd/seqtsne documentation built on Nov. 5, 2022, 6:37 a.m.