ifcb_psd_plot: Generate PSD Plot for a Given Sample

View source: R/ifcb_psd_plot.R

ifcb_psd_plotR Documentation

Generate PSD Plot for a Given Sample

Description

This function generates a plot for a given sample from Particle Size Distribution (PSD) data and fits from Imaging FlowCytobot (IFCB). The PSD data and fits can be generated by ifcb_psd (Hayashi et al. in prep).

Usage

ifcb_psd_plot(sample_name, data, fits, start_fit)

Arguments

sample_name

The name of the sample to plot in DYYYYMMDDTHHMMSS.

data

A data frame containing the PSD data (data output from ifcb_psd), where each row represents a sample and each column represents different particle sizes in micrometers.

fits

A data frame containing the fit parameters for the power curve (fits output from ifcb_psd), where each row represents a sample and the columns include the parameters a, k, and R2.

start_fit

The x-value threshold below which data should be excluded from the plot and fit.

Value

A ggplot object representing the PSD plot for the sample.

References

Hayashi, K., Walton, J., Lie, A., Smith, J. and Kudela M. Using particle size distribution (PSD) to automate imaging flow cytobot (IFCB) data quality in coastal California, USA. In prep.

See Also

ifcb_psd https://github.com/kudelalab/PSD

Examples

## Not run: 
#' # Initialize a python session if not already set up
ifcb_py_install()

# Analyze PSD
psd <- ifcb_psd(feature_folder = 'path/to/features',
                hdr_folder = 'path/to/hdr_data',
                save_data = TRUE,
                output_file = 'psd/svea_2021',
                plot_folder = NULL,
                use_marker = FALSE,
                start_fit = 13,
                r_sqr = 0.5,
                beads = 10 ** 9,
                bubbles = 150,
                incomplete = c(1500, 3),
                missing_cells = 0.7,
                biomass = 1000,
                bloom = 5,
                humidity = NULL)

# Plot PSD of the first sample
plot <- ifcb_psd_plot(sample_name = "D20230316T101514",
                      data = psd$data,
                      fits = psd$fits,
                      start_fit = 10)

# Inspect plot
print(plot)

## End(Not run)

iRfcb documentation built on April 16, 2025, 1:09 a.m.