View source: R/functions-XCMSnExp.R
highlightChromPeaks | R Documentation |
The highlightChromPeaks
function adds chromatographic
peak definitions to an existing plot, such as one created by the
plot
method on a Chromatogram
or
MChromatograms
object.
highlightChromPeaks(
x,
rt,
mz,
peakIds = character(),
border = rep("00000040", length(fileNames(x))),
lwd = 1,
col = NA,
type = c("rect", "point", "polygon"),
whichPeaks = c("any", "within", "apex_within"),
...
)
x |
For |
rt |
For |
mz |
|
peakIds |
|
border |
colors to be used to color the border of the rectangles/peaks.
Has to be equal to the number of samples in |
lwd |
|
col |
For |
type |
the plotting type. See |
whichPeaks |
|
... |
additional parameters to the |
Johannes Rainer
## Load a test data set with detected peaks
library(MSnbase)
data(faahko_sub)
## Update the path to the files for the local system
dirname(faahko_sub) <- system.file("cdf/KO", package = "faahKO")
## Disable parallel processing for this example
register(SerialParam())
## Extract the ion chromatogram for one chromatographic peak in the data.
chrs <- chromatogram(faahko_sub, rt = c(2700, 2900), mz = 335)
plot(chrs)
## Extract chromatographic peaks for the mz/rt range (if any).
chromPeaks(faahko_sub, rt = c(2700, 2900), mz = 335)
## Highlight the chromatographic peaks in the area
## Show the peak definition with a rectangle
highlightChromPeaks(faahko_sub, rt = c(2700, 2900), mz = 335)
## Color the actual peak
highlightChromPeaks(faahko_sub, rt = c(2700, 2900), mz = 335,
col = c("#ff000020", "#00ff0020"), type = "polygon")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.