Skip to contents

Makes a t-SNE plot with color coding for classification correctness and shading for predicted outcome

Usage

plot_tsne(
  df,
  Y,
  A,
  caseColors,
  boxColor,
  pointSize = 1,
  textSize = 1,
  symb = 19,
  bottom_buffer = 1.25,
  all_buffer = 1,
  legend_under_plot = T,
  legend_bg_col = "transparent",
  legend_offset = c(0, 0),
  legend_position = "bottomright",
  shade_name = "Positive classification",
  jitter_factor = 1,
  jitter_amount = NULL,
  max_iter = 1000
)

Arguments

df

dataframe of binary features

Y

vector of binary outcome

A

rule set to use for determining which variables will be used for training t-SNE (will use outcome plus all variables that appear in A)

caseColors

vector colors to use for classification correctness. The first element is for correct, second is for incorrect

boxColor

color for shading

pointSize

cex paramater for plot for size of points

textSize

cex paramater for legend for size of text

symb

pch paramater for plot for symbol of points

bottom_buffer

amount by which to shift bottom of graph up for legend

all_buffer

buffer on all sides of plot

legend_under_plot

whether legend is under plot or inside the plot. Overrides legend_coordinates

legend_bg_col

background color of legend

legend_offset

distance to move legend (as a percentage). Negative values move legend to the left and down, positive values move legend to the right and up. If legend_under_plot=F, then this argument is analagous to the inset arguement for plot

legend_position

position of legend

shade_name

label in legend for shaded points

jitter_factor

factor by which to jitter points

jitter_amount

amount by which to jitter points

max_iter

maximum number of iterations to run t-SNE

Value

t-SNE plot