Plot1DScatters: Plot1DScatters

View source: R/5_plotFunctions.R

Plot1DScattersR Documentation

Plot1DScatters

Description

Function to draw 1D scatter plots of FlowSOM (meta)clusters

Usage

Plot1DScatters(
  fsom,
  channels = fsom$map$colsUsed,
  clusters = NULL,
  metaclusters = NULL,
  maxBgPoints = 3000,
  sizeBgPoints = 0.5,
  colBgPoints = "gray",
  maxPoints = 1000,
  sizePoints = 0.5,
  yLim = NULL,
  xLabels = c("marker"),
  centers = FALSE,
  colors = NULL,
  ncol = NULL,
  nrow = NULL,
  width = NULL,
  height = NULL,
  plotFile = "1DScatterPlots.png"
)

Arguments

fsom

FlowSOM object, as created by FlowSOM

channels

Vector in which each element is a channel or a marker

clusters

Vector with indices of clusters of interest

metaclusters

Vector with indices of metaclusters of interest

maxBgPoints

Maximum number of background cells to plot

sizeBgPoints

Size of the background cells

colBgPoints

Color of background cells

maxPoints

Maximum number of (meta)cluster cells to plot

sizePoints

Size of the (meta)cluster cells

yLim

Optional vector of a lower and upper limit of the y-axis

xLabels

Determines the label of the x-axis. Can be "marker" and\or "channel" or abbreviations. Default = "marker".

centers

Add cluster centers to plot. Default = FALSE.

colors

Vector of colors for all the cells in the selected nodes. First the clusters are colored, then the metaclusters. If NULL, the default ggplot colors, are used.

ncol

Number of columns in the final plot, optional

nrow

Number of rows in the final plot, optional

width

Width of png file. By default NULL the width parameter is estimated based on the input.

height

Height of png file. By default NULL the width parameter is estimated based on the input.

plotFile

If a filepath for a png is given (default = 1DScatterPlots.png), the plots will be plotted in the corresponding png file. If NULL, a list of ggplot objects will be returned

Details

Plot multiple 1D scatter plots in a png file. A subset of fsom$data is plotted in gray, and those of the selected clusters and metaclusters are plotted in color.

Value

If plot is TRUE, nothing is returned and a plot is drawn in which background cells are plotted in gray and the cells of the selected nodes in color. If plot is FALSE, a ggplot objects list is returned.

Examples


# Identify the files
fcs <- flowCore::read.FCS(system.file("extdata", "68983.fcs",
                                     package = "FlowSOM"))
# Build a FlowSOM object
flowSOM.res <- FlowSOM(fcs,
                      scale = TRUE,
                      compensate = TRUE,
                      transform = TRUE,
                      toTransform = 8:18,
                      colsToUse = c(9, 12, 14:18),
                      nClus = 10,
                      seed = 1)

# Make the 1D scatter plots of the clusters and metaclusters of interest
Plot1DScatters(fsom = flowSOM.res,
              channels = c("PE-Cy7-A", "PE-Cy5-A"),
              clusters = c(1, 48, 49, 82, 95),
              metaclusters = list(c(1, 4), 9),
              xLabels = c("marker", "channel"))
Plot1DScatters(flowSOM.res, 
              metaclusters = 4, 
              clusters = c(1, 2),
              colors = c("red", "green", "blue"))                       


saeyslab/FlowSOM documentation built on July 6, 2024, 10:59 a.m.