plotFeatures {ptairMS} | R Documentation

## Plot raw average spectrum around a mzRange

### Description

Plot the raw data spectrum for several files in a ptrSet object around the `mz` masses. The expiration average spectrum is in full lines, and background in dashed lines.

### Usage

    plotFeatures(
      set,
      mz,
      typePlot = "plotly",
      addFeatureLine = TRUE,
      ppm = 2000,
      pdfFile = NULL,
      fileNames = NULL,
      colorBy = "rownames"
    )

    ## S4 method for signature 'ptrSet'
    plotFeatures(
      set,
      mz,
      typePlot = "plotly",
      addFeatureLine = TRUE,
      ppm = 2000,
      pdfFile = NULL,
      fileNames = NULL,
      colorBy = "rownames"
    )

### Arguments

`set` | a `ptrSet-class` object
`mz` | the mz values to plot
`typePlot` | set "plotly" to get an interactive plot, or "ggplot"
`addFeatureLine` | boolean. If TRUE a vertical line at the mz masses is plotted
`ppm` | windows size of the plot round `mz` in ppm
`pdfFile` | a file path to save a pdf with a individual plot per file
`fileNames` | vector of character. The file names you want to plot. If `NULL`, it plot all files
`colorBy` | character. A column name of sample metadata by which the line are colored.

### Value

a plotly or ggplot2 object

### Examples

    dirRaw <- system.file("extdata/exhaledAir", package = "ptairData")
    exhaledPtrset <- createPtrSet(dir=dirRaw,
    setName="exhaledPtrset", mzCalibRef = c(21.022, 60.0525),
    fracMaxTIC = 0.7, saveDir = NULL )
    plotF<-plotFeatures(exhaledPtrset ,mz=59.049,type="ggplot",colorBy="subfolder")
    print(plotF)

[Package ptairMS version 1.2.0 Index]