\name{plot-methods} \docType{methods} \alias{plot-methods} \alias{plot.MSnExp} \alias{plot.Spectrum} \alias{plot} \title{ Plotting 'Spectrum' object(s) } \description{ These method plot mass spectra MZ values against the intensities as line plots. Full spectra (using the \code{full} parameter) or specific peaks of interest can be plotted using the \code{reporters} parameter. If \code{reporters} are specified and \code{full} is set to 'TRUE', a sub-figure of the reporter ions is inlaid inside the full spectrum. If an \code{"\linkS4class{MSnExp}"} is provided as argument, all the spectra are aligned vertically. Experiments can be subsetted to extract spectra of interest using the \code{\link{extractSpectra}} or \code{\link{extractPrecSpectra}} methods. The methods make use the \code{ggplot2} system. An object of class 'ggplot' is returned invisibly. } \arguments{ \item{x}{ Objects of class \code{"\linkS4class{Spectrum}"} or \code{"\linkS4class{MSnExp}"} to be plotted. } \item{y}{ Not used in these methods. } \item{reporters}{ An object of class \code{"\linkS4class{ReporterIons}"} that defines the peaks to be plotted. If not specified, \code{full} must be set to 'TRUE'.} \item{full}{Logical indicating whether full spectrum (respectively spectra) of only reporter ions of interest should be plotted. Default is 'FALSE', in which case \code{reporters} must be defined. } } \section{Methods}{ \describe{ \item{\code{signature(x = "MSnExp", y = "missing", reporters = "ReporterIons", full = "logical")}}{ Plots *all* the spectra in the \code{MSnExp} object vertically. One of \code{reporters} must be defined or \code{full} set to 'TRUE'. In case of \code{MSnExp} objects, repoter ions are not inlaid when \code{full} is 'TRUE'. } \item{\code{signature(x = "Spectrum", y = "missing", reporters = "ReporterIons", full = "logical")}}{ Displays the MZs against intensities of the \code{Spectrum} object as a line plot. At least one of \code{reporters} must be defined or \code{full} set to 'TRUE'. \code{reporters} and \code{full} are used only for \code{"\linkS4class{Spectrum2}"} objects. Full \code{"\linkS4class{Spectrum1}"} spectra are plotted by default. } } } \author{ Laurent Gatto } \examples{ file <- dir(system.file(package="MSnbase",dir="extdata"),full.name=TRUE,pattern="mzXML$") aa <- readMzXMLData(file,verbose=FALSE) data(iTRAQ4) plot(extractPrecSpectra(aa,precursorMz(aa)[1]),reporters=iTRAQ4) plot(extractPrecSpectra(aa,precursorMz(aa)[1]),full=TRUE) plot(aa[["X43"]],reporters=iTRAQ4,full=TRUE) } \keyword{methods}