tof_plot_cells_scatter: Plot scatterplots of single-cell data.

View source: R/visualization.R

tof_plot_cells_scatterR Documentation

Plot scatterplots of single-cell data.

Description

This function makes scatterplots of single-cell data using user-specified x- and y-axes. Additionally, each point in the scatterplot can be colored using a user-specified variable.

Usage

tof_plot_cells_scatter(
  tof_tibble,
  x_col,
  y_col,
  color_col,
  facet_cols,
  theme = ggplot2::theme_bw(),
  ...,
  method = c("ggplot2", "scattermore")
)

Arguments

tof_tibble

A 'tof_tbl' or a 'tibble'.

x_col

An unquoted column name specifying which column in 'tof_tibble' should be used as the x-axis.

y_col

An unquoted column name specifying which column in 'tof_tibble' should be used as the y-axis.

color_col

An unquoted column name specifying which column in 'tof_tibble' should be used to color each point in the scatterplot.

facet_cols

An unquoted column name specifying which column in 'tof_tibble' should be used to break the scatterplot into facets using facet_wrap.

theme

A ggplot2 theme to apply to the scatterplot. Defaults to theme_bw.

...

Optional additional arguments to pass to geom_point if method = "ggplot2" or geom_scattermore if method = "scattermore".

method

A string indicating which plotting engine should be used. Valid values include "ggplot2" (the default) and "scattermore" (recommended if more than 100K cells are being plotted). Note that method = "scattermore" requires the scattermore package to be installed.

Value

A ggplot object.

See Also

Other visualization functions: tof_plot_cells_embedding(), tof_plot_cells_layout()

Examples

sim_data <-
    dplyr::tibble(
        cd45 = rnorm(n = 1000),
        cd38 = c(rnorm(n = 500), rnorm(n = 500, mean = 2)),
        cd34 = c(rnorm(n = 500), rnorm(n = 500, mean = 4)),
        cd19 = rnorm(n = 1000),
        cluster_id = c(rep("a", 500), rep("b", 500))
    )


keyes-timothy/tidytof documentation built on May 7, 2024, 12:33 p.m.