e_plot_projection: Plot projection from high dimensions to 2D

View source: R/e_plot_projection.R

e_plot_projectionR Documentation

Plot projection from high dimensions to 2D

Description

UMAP is very fast and seems to separate better than slower t-SNE.

Usage

e_plot_projection(
  dat_plot = NULL,
  var_group = NULL,
  var_color = NULL,
  var_shape = NULL,
  var_facet = NULL,
  text_title = NULL,
  sw_print = FALSE,
  sw_projection = c("umap", "tsne")[1],
  n_obs_sample = NULL
)

Arguments

dat_plot

data to plot

var_group

variable name to exclude from projection, but may be used for plotting

var_color

variable color

var_shape

variable shape

var_facet

variable to by which to facet wrap

text_title

text for title of plot to override default

sw_print

T/F whether to print plot

sw_projection

Projection type: "tsne" (others to come)

n_obs_sample

number of observations to sample from data since projection calculation can be very expensive for large samples (only for tsne)

Value

     a ggplot object

Examples

e_plot_projection(
    dat_plot                  = dat_mtcars_e |> dplyr::select(mpg, cyl, disp, hp, vs)
  , var_group                 = NULL
  , var_color                 = NULL
  , var_shape                 = NULL
  , var_facet                 = NULL
  , text_title                = NULL
  , sw_print                  = FALSE
  , sw_projection             = c("umap", "tsne")[1]
  , n_obs_sample              = NULL
  )

e_plot_projection(
    dat_plot                  = dat_mtcars_e |> dplyr::select(mpg, cyl, disp, hp, vs)
  , var_group                 = "cyl"
  , var_color                 = "cyl"
  , var_shape                 = "cyl"
  , var_facet                 = "vs"
  , text_title                = NULL
  , sw_print                  = FALSE
  , sw_projection             = c("umap", "tsne")[1]
  , n_obs_sample              = NULL
  )


erikerhardt/erikmisc documentation built on April 17, 2025, 10:48 a.m.