PlotFlowSOM: PlotFlowSOM

View source: R/5_plotFunctions.R

PlotFlowSOMR Documentation

PlotFlowSOM

Description

Base layer to plot a FlowSOM result

Usage

PlotFlowSOM(
  fsom,
  view = "MST",
  nodeSizes = fsom$map$pctgs,
  maxNodeSize = 1,
  refNodeSize = max(nodeSizes),
  equalNodeSize = FALSE,
  backgroundValues = NULL,
  backgroundColors = NULL,
  backgroundSize = 1.5,
  equalBackgroundSize = FALSE,
  backgroundLim = NULL,
  title = NULL
)

Arguments

fsom

FlowSOM object, as created by FlowSOM

view

Preferred view, options: "MST", "grid" or "matrix" with a matrix/dataframe consisting of coordinates. Default = "MST"

nodeSizes

A vector containing node sizes. These will automatically be scaled between 0 and maxNodeSize and transformed with a sqrt. Default = fsom$MST$sizes

maxNodeSize

Determines the maximum node size. Default is 1.

refNodeSize

Reference for node size against which the nodeSizes will be scaled. Default = max(nodeSizes)

equalNodeSize

If TRUE, the nodes will be equal to maxNodeSize. If FALSE (default), the nodes will be scaled to the number of cells in each cluster

backgroundValues

Values to be used for background coloring, either numerical values or something that can be made into a factor (e.g. a clustering)

backgroundColors

Color palette to be used for the background coloring. Can be either a function or an array specifying colors.

backgroundSize

The size of the background. Will be multiplied by the size of the nodes.

equalBackgroundSize

If you want the background sizes to be the same size.

backgroundLim

Only used when backgroundValues are numerical. Defaults to min and max of the backgroundValues.

title

Title of the plot

Details

Base layer of the FlowSOM plot, where you can choose layout (MST, grid or coordinates of your own choosing), background colors and node size. Can then be extended by e.g. AddStars, AddLabels, AddPies, ...

Value

A ggplot object with the base layer of a FlowSOM plot

See Also

PlotStars, PlotVariable, PlotMarker, PlotLabels, PlotNumbers, PlotPies, QueryStarPlot, PlotSD

Examples

# Locate file on file system
fcs_file <- system.file("extdata", "68983.fcs", package = "FlowSOM")

# Build FlowSOM model
flowSOM.res <- FlowSOM(fcs_file, 
                       scale = TRUE,
                       compensate = TRUE, 
                       transform = TRUE,
                       toTransform = 8:18, 
                       colsToUse = c(9, 12, 14:18),
                       nClus = 10,
                       seed = 1)
                       
# Plot with background coloring
PlotFlowSOM(flowSOM.res,
            backgroundValues = flowSOM.res$metaclustering) %>% 
            AddLabels(seq(100))



SofieVG/FlowSOM documentation built on Feb. 1, 2024, 11:33 a.m.