plot_gauss2 {gcxgclab} | R Documentation |
Plots a 3D peak with the fitted Gaussian curve.
Description
plot_gauss2
Plots a 3D peak with the fitted Gaussian curve.
Usage
plot_gauss2(TIC_df, gauss2_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. |
gauss2_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 with a
contour plot of the Gaussian curve fit to the peak data, using
ggplot
from ggplot2 package
(Wickham 2016).
Value
A ggplot object. A contour 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)
gaussfit2 <- gauss2_fit(frame$TIC_df, peakcoord=c(peaks$'X'[1], peaks$'Y'[1]))
message(paste('Volume under curve =',gaussfit2[[3]],'u^3'))
plot_gauss2(frame$TIC_df, gaussfit2[[1]])