plotRefSpectra | R Documentation |
A simple function to plot the reference spectrum of a compound in the style of common visualization tools. This is useful when comparing the spectrum of a metabolite with such software tools.
plotRefSpectra(lib, libID, col='darkblue', main=NULL, xlab='m/z', ylab='Intensity',
label=TRUE, cex=0.8, label_col=NULL, sel_font=4, type='h', ...)
lib |
A |
libID |
An index (integer or character) value representing the respective metabolite in
the reference library |
col |
The color(s) of the vertical lines. This option is passed to
|
main |
The title for the plot. If |
xlab |
The x axis label. Passed to |
ylab |
The y axis label. Passed to |
label |
Logical. It controls whether the m/z labels are displayed. |
cex |
The |
label_col |
The color vector for the m/z labels. |
sel_font |
The font for the m/z labels of the selective masses. This should
be an integer like the parameter |
type |
A character that specifies the plot type. Defaults to |
... |
Extra graphical parameters passed to |
This is a simple function to plot the spectrum of a reference metabolite. It is expected that the spectrum for that metabolite is not empty, in which case nothing is plotted and a warning is thrown.
The m/z label positions are determined automatically such that they do not intersect with each other and do not touch the vertical lines of the plot.
Returns invisible()
.
Alvaro Cuadros-Inostroza
See the function ImportLibrary
for importing a metabolite library.
See plot
and par
for graphical parameters.
def.par <- par(no.readonly = TRUE) # save parameters for resetting
# load pre-calculated example data files and objects
data(TSExample)
# plot the reference spectrum of the compound ID 'GC.3'
plotRefSpectra(refLibrary, 'GC.3')
# that is equivalent to
plotRefSpectra(refLibrary['GC.3'])
# change some graphical parameter and add a grid via 'panel.first'
plotRefSpectra(refLibrary, 'GC.3', col='darkred', main='Valine', xlab='mz',
ylab='intensity', cex=0.7, label_col='blue', sel_font=2,
panel.first=grid())
par(def.par) # reset to default
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.