Description Usage Arguments Details Value Author(s) Examples
View source: R/DrawChromatogram.R
Plot a chromatogram, color the area under specified peak(s), and calculate the peak area(s).
1 2 3 |
time |
numeric vector containing the time points (the x-axis). |
intensity |
numeric vector containing the respective signal intensities at each time point (the y-axis). |
range |
list describing the start and stop time points for each peak, defined as |
color |
vector of character strings specifying the color for each peak given in |
xlab |
character string specifying the x-axis label. |
ylab |
character string specifying the y-axis label. |
ylim |
numeric vector of length 2 specifying the range of the y axis. |
las |
numeric value specifying the rotation of the axis labels, see par for options. |
... |
additional parameters to be passed to plot(). |
The area under the peak(s) is rendered using the polygon
function. The area calculation assumes that the polygon does not self-intersect.
A data frame with the following column names.
retention.time |
retention times of the peaks specified in |
area |
the respective peak areas |
apex.intensity |
the respective intensities at each peak apex |
Nathan G. Dodder
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## single peak
x <- DrawChromatogram(example.chromatogram.single$time,
example.chromatogram.single$intensity/100,
range = list(start = 25.4, stop = 26.1),
main = "example chromatogram 1",
ylab = "intensity x 100")
# label peak with retention time and area
text(x$retentionTime, x$apexIntensity + 1500,
labels = paste("RT = ", round(x$retentionTime, digits = 1),
", Area = ", round(x$peakArea), sep = ""), cex = 0.9)
## multiple peaks
y <- DrawChromatogram(example.chromatogram.multiple$time,
example.chromatogram.multiple$intensity / 1000,
range = list(start = c(21.5, 21.925, 23.1, 25.5, 27.35),
stop = c(21.925, 22.4, 23.6, 26.2, 28.0)),
color = c("blue", "red", "green", "yellow", "orange"),
xlab = "retention time (min)",
ylab = "intensity x 1000 (cps)",
main = "Example Chromatogram")
## label peaks
text(y$retentionTime, y$apexIntensity + 50, labels = c("a", "b", "c", "d", "e"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.