drawSpecPPM: Plot NMR spectra from a spectra data matrix

View source: R/drawSpecPPM.R

drawSpecPPMR Documentation

Plot NMR spectra from a spectra data matrix

Description

This function plots NMR spectra (so with the largest ppm values on the left) with a number of plotting options

Usage

drawSpecPPM(
  Y.spec,
  X.ppm,
  LeftIndex = -1,
  RightIndex = -1,
  groupFactor = NULL,
  useLog = FALSE,
  maxHeight = -1,
  minHeight = -1,
  nAxisPos = 4,
  xlab = NULL,
  ylab = NULL,
  title = NULL,
  ticks = NULL,
  ROI = NULL,
  ROI.ppm = NULL,
  roiWidth = 100,
  roiWidth.ppm = NULL,
  legend.extra.x = 2,
  legend.extra.y = 2,
  legendpos = NULL,
  colourstyle = "ggplot",
  manual.colours = NULL,
  lwd = 1,
  noLegend = FALSE
)

Arguments

Y.spec

(required) The raw spectra in matrix format (1 sample per row) or numeric vector (in case of 1 spectrum)

X.ppm

(required) The vector with the ppm values

LeftIndex

The starting index of the ppm values for plotting. default = -1 indicates the first ppm (the largest) value is the start of the plot

RightIndex

The stopping index for plotting. default = -1 indicates the last ppm value (the smallest) is the end of the plot

groupFactor

The groupFactors. If provided different colors will be used for each group.

useLog

If set to 'TRUE' the spectra will be log10 transformed (default = FALSE).

maxHeight

The maximal height of the plot (default = -1, this indicates no maximal value).

minHeight

The minimal height of the plot (default = -1, this indicates no minimal value).

nAxisPos

The number of equally spaced tickmarks.

xlab

The label on the x axis.

ylab

The label on the y axis.

title

The title of the plot.

ticks

Position tick manually by providing ppm values.

ROI

If provided (with an index value, not a ppm value) only this region of interest will be plotted. (supply no ROI or ROI.ppm values, for the full spectrum, or specify only 1, either ROI or ROI.ppm).

ROI.ppm

If provided (a ppm value, not an index value) only this region of interest will be plotted. (supply no ROI or ROI.ppm values, for the full spectrum, or specify only 1, either ROI or ROI.ppm).

roiWidth

The width of the ROI (region of interest) plot in index points/measurement points. The plot will span from ROI/ROI.ppm - roiWidth to ROI/ROI.ppm + roiWidth. (only supply roiWidth or roiWidth.ppm if needed).

roiWidth.ppm

The width of the ROI (region of interest) plot in ppm. The plot will span from ROI/ROI.ppm - roiWidth.ppm to ROI/ROI.ppm + roiWidth.ppm. (only supply roiWidth or roiWidth.ppm if needed).

legend.extra.x

Increase (or decrease) the horizontal space in the legend, this is useful for exporting larger figures.

legend.extra.y

Increase (or decrease) the vertical space in the legend, this is useful for exporting larger figures.

legendpos

The position of the legend (standard R legend positioning, default = 'topleft').

colourstyle

The colours used in the plot, either standard R or ggplot colours (default).

manual.colours

Provide specific colours to be used in the plot.

lwd

The linewidth.

noLegend

If set to TRUE no legend will be plotted (default = FALSE).

Value

an R plot

Author(s)

Charlie Beirnaert, charlie.beirnaert@uantwerpen.be

Examples

data(Winedata)
Spectra = Winedata$spectra 
ppm.wine = Winedata$ppm
wine.color = Winedata$wine.color 
drawSpecPPM(Y.spec=Spectra, X.ppm=ppm.wine, groupFactor = wine.color, 
title = 'Raw wine data spectra')



speaq documentation built on May 23, 2022, 5:06 p.m.