Learn R Programming

gcxgclab (version 1.0.1)

plot_gauss: 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")

Value

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

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 ggplot2gcxgclab.

References

Examples

Run this code
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]])

Run the code above in your browser using DataLab