Learn R Programming

qpcR (version 1.4-1)

plot.pcrfit: Plotting qPCR data with fitted curves

Description

A plotting function for data of class 'pcrfit' (single curves) or 'modlist' (batch curves) displaying the data points and the fitted curve. Four different plot types are available, namely plotting all curves in a 2D graph, a 2D plot matrix, a 3D graph or a heatmap-like image plot.

Usage

# S3 method for pcrfit
plot(x, type = c("all", "single", "3D", "image"), 
        fitted = TRUE, add = FALSE, col = NULL, par2D = list(),
        par3D = list(), ...)

Arguments

x

an object of class 'pcrfit' or 'modlist'.

type

plots all curves in 2D ("all"), a plot matrix with many curves ("single"), a 3D plot ("3D") or a heatmap-like image plot (image).

fitted

should the fitted lines be displayed?

add

should the curve be added to an existing plot?

col

an optional color vector for the individual curves. Is recycled to the number of runs in x.

par2D

a list containing graphical parameters to change the 2D-plots: plot, points or lines.

par3D

a list containing graphical parameters to change the 3D-plot: plot3d, points3d, lines3d, axis3d or mtext3d.

...

other parameters for downstream methods.

Value

A 2D, multiple 2D, 3D or heatmap-like qPCR plot.

Details

Uses the 'rgl' package for 3D plots. If the 'modlist' contains runs that failed to fit, these are displayed with RED asterisked names. In addition, sigmoidal outlier runs will be displayed in BLUE with double asterisked names. This approach makes the identification of failed runs easy and works only with type = "single". See 'Examples'. For high-throughput data, the user of this function is encouraged to use the "image" kind of plot, as one can see quite nicely the differences in the amplification profiles of several hundred runs. Of course, this plot type does not display the fitted curve. See 'Examples'.

Examples

Run this code
# NOT RUN {
## Single plot.
m1 <- pcrfit(reps, 1, 2, l5)
plot(m1)

## Add another plot in blue.
m2 <- pcrfit(reps, 1, 12, l5)
plot(m2, add = TRUE, col = 4)

## Plot a 'modlist' batch with coloring of replicates.
ml1 <- modlist(reps, 1, 2:13, model = l4)
plot(ml1, col = gl(3,4))   

## Subset of cycle range.
plot(ml1, col = rep(1:3, each = 4), 
     par2D = list(xlim = c(10, 30)))

## Plot single curves for diagnostics.
plot(ml1, type = "single", col = rep(1:3, each = 4))

## 3D plots of 'modlist's.
plot(ml1, type = "3D", col = rep(1:3, each = 4))
rgl.close()

# }
# NOT RUN {
## Example for "image" type when
## using large data.
ml2 <- modlist(vermeulen2)
plot(ml2, type = "image")

## Example for outlier identification:
## RED/*name* indicates failed fitting,
## BLUE/**name** indicates sigmoidal outlier
## using 'testdat' set.
ml3 <- modlist(testdat, model = l5)
plot(ml3, type = "single") 
# }

Run the code above in your browser using DataLab