Skip to contents

Intended for plotting data for one site at a time; data may need to be subset or filtered by user prior to plotting.

The function generates a ggplot object, that is optionally saved as a .png file. If multiplot = TRUE, the png file is named "Multi_Plot.png". If multiplot = FALSE, a separate png file is produced for each biology metric, named "biolmetric_Plot.png".

Usage

plot_hev(data, date_col, flow_stat, biol_metric, multiplot = TRUE, save = FALSE, save_dir = getwd(), clr_by = NULL)

Arguments

data

Data to plot.

date_col

Name of column containing time variable for x-axis.

flow_stat

Names of up to two flow statistics of interest.

biol_metric

Names of up to four biology metrics of interest.

multiplot

If TRUE, a multiplot of up to four biology metrics is produced; if FALSE, a single plot is produced for each biology metric. Default = TRUE.

save

Specifies if outputs should also be saved as png files. Default = FALSE.

save_dir

Path to folder where png files are to be saved; Default = Current working directory.

clr_by

Selected variable by which to colour biol_metric points. Default = NULL.

Value

Depending on the multiplot argument, the function returns either a single ggplot object, or a list of ggplot objects.

Examples

## Generate hev plots for four biology metrics at one site of interest
# plot_hev(data = subset(all_data, biol_site_id = "100582"),
#            date_col = "SAMPLE_DATE",
#            flow_stat = c("Q95z", "Q10z"),
#            biol_metric = c("LIFE_F_OE", "WHPT_ASPT_OE", "WHPT_NTAXA_OE", "PSI_OE"),
#            multiplot = TRUE)