plot_path: plot_path

View source: R/functions_path.R

plot_pathR Documentation

plot_path

Description

Traces a path through the t-sne space in tall_var line order defined by qtall_vars for ids in id_to_plot

Usage

plot_path(
  tsne_dt,
  qtall_vars,
  id_to_plot,
  p = NULL,
  xrng = c(-0.5, 0.5),
  yrng = c(-0.5, 0.5),
  arrowhead_position = c("end", "each")[1],
  line_type = c("curve", "spline", "straight")[2],
  label_type = c("text", "label", "none")[2],
  bg_points = 5000,
  arrow_FUN = NULL
)

Arguments

tsne_dt

data.table with tsne info (tx, ty, id, and tall_var)

qtall_vars

character vector of items in tsne_dt$tall_var

id_to_plot

character vector of ids in tsne_dt$id

p

exiting ggplot to add a layer onto. Default of NULL creates a new ggplot.

xrng

numeric of length 2. passed to coord_cartesian xlim. Not used if p is specified. Default is c(-.5, .5).

yrng

numeric of length 2. passed to coord_cartesian ylim. Not used if p is specified. Default is c(-.5, .5).

arrowhead_position

character, must be one of "each" or "end". Determines if arrowheads are drawn for each segment or only on the final segment.

line_type

character vector describing type of line to connect qtall_vars. One of : curve, spline, or straight

label_type

character vector describing labelling method for points along lines. One of : text, label, or none.

bg_points

number of background id points to plot.

arrow_FUN

result of grid::arrow(). Default of NULL does not draw arrowheads.

Details

Good for looking at a small number of ids in a modest number of tall_vars.

Value

ggplot showing how individual ids behave across qtall_vars.

Examples

data(tsne_dt)
plot_path(tsne_dt, unique(tsne_dt$tall_var), unique(tsne_dt$id)[1:3])
plot_path(tsne_dt, unique(tsne_dt$tall_var), unique(tsne_dt$id)[1:3],
    arrowhead_position = "each", label_type = "none")
plot_path(tsne_dt, unique(tsne_dt$tall_var), unique(tsne_dt$id)[1:3],
    arrowhead_position = "end", label_type = "none", line_type = "spline",
    arrow_FUN = arrow())

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