plot_outline: plot_outline

View source: R/functions_path.R

plot_outlineR Documentation

plot_outline

Description

a ggplot where the position of id in every tall_var specified by qtall_vars is connected in a polygon. Allows the identification of both regions where ids are stable/dynamic and individual ids that are particularly dynamic.

Usage

plot_outline(
  tsne_dt,
  qtall_vars,
  id_to_plot = NULL,
  p = NULL,
  xrng = c(-0.5, 0.5),
  yrng = c(-0.5, 0.5),
  bg_color = "gray",
  line_color_mapping = "black",
  fill_color_mapping = "gray",
  label_type = c("text", "label", "none")[3],
  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).

bg_color

character. color to use for background points. Default is "gray"

line_color_mapping

character that is valid color. If less than length of id_to_plot, recycled across specified id_to_plot. Can be named vector to completely specify id_to_plot.

fill_color_mapping

character that is valid color. If less than length of id_to_plot, recycled across specified id_to_plot. Can be named vector to completely specify id_to_plot.

label_type

character. one of c("text", "label", "none"). controls how, if at all, plot objects are labelled.

bg_points

number of points to plot in background. if 0, only points corresponding to id_to_plot are drawn. if -1, no points at all are drawn.

arrow_FUN

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

Details

Good for looking at large numbers of ids with a modest number of tall_vars.

Value

a ggplot

Examples

data(tsne_dt)
plot_outline(tsne_dt, unique(tsne_dt$tall_var), unique(tsne_dt$id)[1:3])
plot_outline(tsne_dt, unique(tsne_dt$tall_var), unique(tsne_dt$id)[1:3],
    label_type = "none")
plot_outline(tsne_dt, unique(tsne_dt$tall_var), unique(tsne_dt$id)[1:3],
    label_type = "label")

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