selectable_scatter_plot: selectable_scatter_plot

View source: R/selectable_scatter_plot.R

selectable_scatter_plotR Documentation

selectable_scatter_plot

Description

A scatterplot with dropdown menus to select both the x & y variables and the variable used to colour the points.

Usage

selectable_scatter_plot(coords, colours, title = "", select_first = NULL)

pca_selectable_scatter_plot(mat, df, ...)

Arguments

coords

data.frame or matrix of point co-ordinates Each column will be an entry in the X and Y drop-down menus

colours

data.frame of variables used to colour points

title

Plot title.

select_first

Variable to use as default colour when plot is loaded.

mat

Matrix to calculate PCs.

df

data.frame of covariates to associate with PCs of mat.

...

Passed to selectable_scatter_plot.

Examples

pcs <- prcomp(mtcars)
colours <- mtcars[, c("cyl", "vs", "am", "gear", "carb")]
colours[] <- lapply(colours, as.character)
selectable_scatter_plot(
  pcs$x,
  colours,
  "Interactive PCA plot"
)

Alanocallaghan/plotlyutils documentation built on May 3, 2023, 8:34 p.m.