plot_gauss {gcxgclab}R Documentation

Plots a peak with the fitted Gaussian curve.

Description

plot_gauss Plots a peak with the fitted Gaussian curve.

Usage

plot_gauss(TIC_df, gauss_return, title = "Peak fit to Gaussian")

Arguments

TIC_df

a data.frame object. Data frame with 4 columns (Overall Time Index, RT1, RT2, TIC), ideally the output from create_df(), or the first data frame returned from extract_data(), $TIC_df.

gauss_return

a data.frame object. The output from guass_fit(). A data frame with two columns, (time, guassfit), the time values around the peak, and the intensity values fitted to the optimal Gaussian curve.

title

a string object. Title placed at the top of the plot.

Details

This function plots the points around the peak in blue dots, with a line plot of the Gaussian curve fit to the peak data in red, using ggplot from ggplot2 package (Wickham 2016).

Value

A ggplot object. A plot of points around the peak with a line plot of the Gaussian curve fit to the peak data.

References

Wickham H (2016). ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. ISBN 978-3-319-24277-4, https://ggplot2.tidyverse.org.

Examples

file <- system.file("extdata","sample1.cdf",package="gcxgclab")
frame <- extract_data(file,mod_t=.5)
peaks <- top_peaks(frame$TIC_df, 5)
gaussfit <- gauss_fit(frame$TIC_df, peakcoord=c(peaks$'X'[1], peaks$'Y'[1]))
message(paste('Area under curve =',gaussfit[[3]], 'u^2'))
plot_gauss(frame$TIC_df, gaussfit[[1]])


[Package gcxgclab version 1.0.1 Index]