Learn R Programming

MALDIquant (version 0.2)

labelPeaks-methods: Draws peak labels to plot.

Description

labelPeaks draws the corresponding mass values on top of the peaks stored in a SinglePeakList object to a plot.

Usage

## S3 method for class 'SinglePeakList':
labelPeaks(x,
    number=10, decreasing=TRUE, xlim=c(min(x@mass),
    max(x@mass)), underline=TRUE, upsideDown=FALSE,
    verticalOffset=ceiling(max(x@intensity)/20), col="black", cex=0.7,
    adj=c(0.5, 0),
    ...)

Arguments

x
SinglePeakList object
number
number of peaks to label
decreasing
control sorting; if decreasing == TRUE (decreasing == FALSE) label the number most (less) accumulated intensity
xlim
only label intensity between xlim[1] and xlim[2]
underline
underline peak values?
upsideDown
if upsideDown == TRUE invert peak values
verticalOffset
move label vertically
col
text colour, see par
cex
font size, see par
adj
adjust text to the left, center, right and top, center, bottom; see text
...
arguments to be passed to text

See Also

SinglePeakList, plot,AbstractSpectrumData,missing-method

Examples

Run this code
## load library
library("MALDIquant");

## create a SinglePeakList object from scratch
spl <- new("SinglePeakList", mass=1:5, intensity=sample(x=100:10000, size=5),
metaData=list(name="unrealistic example"));

## plot peaks
plot(spl);

## label peaks
labelPeaks(spl);

Run the code above in your browser using DataLab