Skip to contents

This function generates two sets of plots for monthly regression and fractions between nutrient parts and the total.

Usage

plot_fractions(df, station, total_var, min_vars)

Arguments

df

Dataframe with formatted data (requires "Station", "DATE", "Variables", and "Values" columns). Data can be loaded with load_template function using 'xlsx' template file.

station

Character vector indicating the station/s to be selected for the figure.

total_var

Character vector for the variable selected to represent the total of a certain nutrient.

min_vars

Character vector for the variable/s selected to represent the mineral or organic fraction of a certain nutrient.

Value

A list of two ggplot objects: "regression" for monthly regression plots and "fraction" for monthly fraction values.

Examples

if (FALSE) {
# Example using calibration data
temp_path <- system.file("extdata", "calibration_data.xlsx", package = "SWATprepR")
cal_data <- load_template(temp_path)
plot_fractions(cal_data$data, c("4"), c("PT"), c("P-PO4"))
}