facs_plot {beadplexr}R Documentation

Plot FACS data.

Description

Wrappers around building a ggplot with geom_point, geom_density_2d, and geom_hex.

Usage

facs_plot(
  df,
  .x = "FSC-A",
  .y = "SSC-A",
  .type = c("scatter", "density1d", "density2d", "hexbin"),
  .data = NULL,
  ...
)

facs_scatter(
  df,
  .x = "FSC-A",
  .y = "SSC-A",
  .beads = NULL,
  .plot_distinct = TRUE,
  .data = NULL
)

facs_density2d(df, .x = "FSC-A", .y = "SSC-A", .beads = NULL, .data = NULL)

facs_density1d(df, .x = "FSC-A", .beads = NULL, .data = NULL)

facs_hexbin(df, .x = "FSC-A", .y = "SSC-A", .bins = 75, .data = NULL)

Arguments

df

The data to be plotted in a data.frame.

.x, .y

Character vector with the column name for the variable to plot on the x or y-axis.

.type

Character vector giving the type of plot being used. Options are one of "scatter", "density", "hexbin".

.data

Deprecated. Use df.

...

Arguments passed to the individual functions.

.beads

Character vector to with the column name with identification of beads. If used it will show up with the aesthetic 'color'. Defaults to not being used.

.plot_distinct

Boolean to decide if only distinct events should be plotted. If used, the number of data points might be greatly reduced which could make for faster plotting. Defaults to TRUE.

.bins

Numeric vector giving number of bins in both vertical and horizontal directions. Set to 75 by default.

Details

These plot functions are meant to provide a quick way of viewing the FACS data. For more control, use ggplot2 directly.

Value

A ggplot

Examples

## Not run: 
library(beadplexr)

.file_name <- system.file("extdata", "K2-C07-A7.fcs",
                          package = "beadplexr")

df <- read_fcs(.file_name = .file_name,
                  .filter = list("FSC-A" = c(2e5L, 6.3e5L),
                                 "SSC-A" = c(2e5, 1e6L)))
df$bead_group <- ifelse(df$`FSC-A` < 4e5L, "A", "B")

# Using facs_plot
facs_plot(df, .type = "scatter")
facs_plot(df, .type = "density1d")
facs_plot(df, .type = "density2d")
facs_plot(df, .type = "hexbin")

facs_plot(df, .type = "scatter", .beads = "bead_group")
facs_plot(df, .type = "density1d", .beads = "bead_group")
facs_plot(df, .type = "hexbin", .bins = 50)

facs_plot(df, .x = "FL2-H", .type = "scatter", .beads = "bead_group")

# Individual functions
facs_scatter(df)

facs_scatter(df, .beads = "bead_group", .plot_distinct = FALSE)
facs_scatter(df, .beads = "bead_group")

facs_scatter(df, .x = "FL2-H", .y = "FL6-H", .beads = "bead_group")

facs_density1d(df)
facs_density1d(df, .beads = "bead_group")

facs_density2d(df)
facs_density2d(df, .beads = "bead_group")

facs_hexbin(df)
facs_hexbin(df, .bins = 30)

## End(Not run)

[Package beadplexr version 0.4.0 Index]