Last data update: 2014.03.03

R: Contour plots for flow data
contour-methodsR Documentation

Contour plots for flow data

Description

Basic contour plots for both flowFrames and flowSets. The densities for the contours are estimated using the fast kernel density estimation algorithm bkde2D.

Usage

## S4 method for signature 'flowFrame'
contour(x, y = 1:2, nlevels = 10, bw,
  grid.size = c(65, 65), add = FALSE, xlab, ylab, xlim, ylim, lwd = 1,
  lty = 1, col = par("fg"), fill = "transparent", ...)

Arguments

x

An object of class flowFrame or flowSet.

y

Numeric or character vector of length 2 indicating the channels to plot.

nlevels

The approximate number of contour line levels, see contour for details.

bw

The bandwidth factor used for the kernel density estimation, see bkde2D for details.

grid.size

The grid size used for the kernel density estimation, see bkde2D for details.

add

Logical, indicating whether contour lines should be superimposed on an existing plot.

xlab,ylab

The axis annotation.

xlim,ylim

The plotting ranges.

lwd,lty,col,fill

The usual plotting parameters, i.e. the line width, line type, line color and fill color. When using a fill color you should consider alpha blending to improve the results.

...

Parameters that are passed on to the plotting functions.

Methods

x = "flowFrame"

A regular contour plot of the flow data in the frame. It can be added on top of an existing plot using the add argument.

x = "flowSet"

Overlay of contours of densities for each individual frame in the set. You should consider using differnt colors and alpha blending to improve the result. This is only useful for a very limited number of frames in a set (~5), for larger sets you should consider a panelled lattice-type plot. Not that bw, gridSize and nlevels are passed on via the ... argument.

Author(s)

F. Hahne

See Also

bkde2D, contour, flowFrame, flowSet

Examples

data(GvHD)

## simple contour plot
contour(GvHD[[1]])

## overlay with existing plot
plot(GvHD[[1]], c("FSC-H", "SSC-H"))
contour(GvHD[[1]], add=TRUE, col="lightgray", lty=3)

## colored contours
contour(GvHD[[1]], fill="red")
cols <- rainbow(3, alpha=0.1)
contour(GvHD[[1]], fill=cols, col=cols)

## overlay of multiple flowFrames in a flowSet
contour(GvHD[1:3], col=cols, fill=cols)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(flowViz)
Loading required package: flowCore
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/flowViz/contour-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: contour-methods
> ### Title: Contour plots for flow data
> ### Aliases: contour contour,ANY-method contour,flowFrame-method
> ###   contour,flowSet-method contour-methods
> ### Keywords: methods
> 
> ### ** Examples
> 
> data(GvHD)
> 
> ## simple contour plot
> contour(GvHD[[1]])
> 
> ## overlay with existing plot
> plot(GvHD[[1]], c("FSC-H", "SSC-H"))
> contour(GvHD[[1]], add=TRUE, col="lightgray", lty=3)
> 
> ## colored contours
> contour(GvHD[[1]], fill="red")
> cols <- rainbow(3, alpha=0.1)
> contour(GvHD[[1]], fill=cols, col=cols)
> 
> ## overlay of multiple flowFrames in a flowSet
> contour(GvHD[1:3], col=cols, fill=cols)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>