Plot2DScatters {FlowSOM} | R Documentation

## Plot2DScatters

### Description

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

### Usage

    Plot2DScatters(
      fsom,
      channelpairs,
      clusters = NULL,
      metaclusters = NULL,
      maxBgPoints = 3000,
      sizeBgPoints = 0.5,
      maxPoints = 1000,
      sizePoints = 0.5,
      xLim = NULL,
      yLim = NULL,
      density = TRUE,
      centers = TRUE,
      color = NULL,
      plotFile = "2DScatterPlots.png"
    )

### Arguments

`fsom` | FlowSOM object, as created by `FlowSOM`
`channelpairs` | List in which each element is a pair of channel or marker names
`clusters` | Vector or list (to combine multiple clusters in one plot) with clusters of interest
`metaclusters` | Vector or list (to combine multiple metaclusters in one plot) with metaclusters of interest
`maxBgPoints` | Maximum number of background cells to plot
`sizeBgPoints` | Size of the background cells
`maxPoints` | Maximum number of (meta)cluster cells to plot
`sizePoints` | Size of the (meta)cluster cells
`xLim` | A vector of a lower and upper limit of the x-axis
`yLim` | A vector of a lower and upper limit of the y-axis
`density` | Default is `TRUE` to color the (meta)cluster points according to density. Set to `FALSE` to use a plain color
`centers` | Default is `TRUE` to show the cluster centers
`color` | Colors for all the cells in the selected nodes (ordered list). If `NULL` the default ggplot colors, indexed by metacluster number are used.
`plotFile` | If a filepath for a png is given (default = 2DScatterPlots.png), the plots will be plotted in the corresponding png file. If `NULL`, a list of ggplot objects will be returned

### Details

Plot multiple 2D scatter plots in a png file. A subset of fsom$data is plotted in grey, 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 grey 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 2D scatter plots of the clusters and metaclusters of interest
    Plot2DScatters(fsom = flowSOM.res,
                   channelpairs = list(c("PE-Cy7-A", "PE-Cy5-A"),
                                       c("PE-Texas Red-A", "Pacific Blue-A")),
                   clusters = c(1, 48, 49, 82, 95),
                   metaclusters = list(c(1, 4), 9),
                   density = FALSE)

    Plot2DScatters(fsom = flowSOM.res,
                   channelpairs = list(c("PE-Texas Red-A", "Pacific Blue-A")),
                   metaclusters = list(c(1, 4)),
                   density = FALSE,
                   color = list(c("red", "green")))

[Package FlowSOM version 2.2.0 Index]