This function allows to plot a slice of a mass spectrometry imaging dataset
represented by a list of AbstractMassObject objects
or an array or a matrix.
The mass spectrometry imaging dataset. It could be a list of
MassSpectrum/MassPeaks objects or
an array (e.g. generated by msiSlices) or
a matrix.
center
double, if x is a list of
MassSpectrum/MassPeaks objects
this argument represent the center mass value of the slices,
see msiSlices for details.
tolerance
double, if center is given tolerance
specifies the thickness of the slices (center + c(-tolerance,
tolerance)), see msiSlices for details.
colRamp
colours as colorRampfunction, see
colorRamp for details. If combine=TRUE
multiple colour functions must be applied as list with an length that
equals the number of given centers.
interpolate
logical, use linear interpolation when drawing the
image, see rasterImage for details.
scale
logical, if TRUE all values are divided by the
maximal value of the slice to get values between 0 and 1.
legend
logical, if TRUE a reference color gradient is
plotted on the right hand side of the plot. The upper color represents the
highest value in the slice and the lower color the lowest value
respectively. The legend is disabled if scale=FALSE.
alignLabels
logical, if combine=TRUE and
alignLabels=TRUE the center positions below the legend are aligned
on the right margin otherwise the aligned to their corresponding gradient.
combine
logical, if TRUE multiple centers are plotted in
one image. Therefore it would be necessary to apply a list of colRamp
functions (one function for each center). The intensity values for each
center of each pixel are compared against each other and the highest scaled
intensity determines the center (and the corresponding colRamp).
plotInteractive
logical, if the slice array contains multiple centers,
combine=FALSE and an interactive plotting device is used a warning is
thrown and only the first center would be plotted. Use
plotInteractive=TRUE to overwrite this behaviour and to plot multiple
centers on an interactive device.
...
arguments to be passed to plot, e.g.
main.
Details
Each MassSpectrum/MassPeaks object in
x must contain a list named imaging with an element
pos that stores the x and y value of the spectrum, e.g.:
## load package
library("MALDIquant")
## load example data
data("fiedler2009subset", package="MALDIquant")
## please note: this is NOT a MSI data set
## we just add some coordinates for demonstration
coordinates(fiedler2009subset) <- cbind(x=rep(1:4, 2), y=rep(1:2, each=4))
plotMsiSlice(fiedler2009subset, center=8936.97, tolerance=0.25)
plotMsiSlice(fiedler2009subset, center=c(5864.49, 8936.97), tolerance=0.25,
combine=TRUE,
colRamp=list(colorRamp(c("#000000", "#FF00FF")),
colorRamp(c("#000000", "#00FF00"))))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(MALDIquant)
This is MALDIquant version 1.15
Quantitative Analysis of Mass Spectrometry Data
See '?MALDIquant' for more information about this package.
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MALDIquant/plotMsiSlice-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: plotMsiSlice-methods
> ### Title: Plots a Mass Spectrometry Imaging dataset.
> ### Aliases: plotMsiSlice plotMsiSlice,list-method
> ### plotMsiSlice,array-method plotMsiSlice,matrix-method
> ### Keywords: Graphics|hplot
>
> ### ** Examples
>
> ## load package
> library("MALDIquant")
>
> ## load example data
> data("fiedler2009subset", package="MALDIquant")
>
> ## please note: this is NOT a MSI data set
> ## we just add some coordinates for demonstration
> coordinates(fiedler2009subset) <- cbind(x=rep(1:4, 2), y=rep(1:2, each=4))
>
> plotMsiSlice(fiedler2009subset, center=8936.97, tolerance=0.25)
>
> plotMsiSlice(fiedler2009subset, center=c(5864.49, 8936.97), tolerance=0.25,
+ combine=TRUE,
+ colRamp=list(colorRamp(c("#000000", "#FF00FF")),
+ colorRamp(c("#000000", "#00FF00"))))
>
>
>
>
>
> dev.off()
null device
1
>