seasyrplot function

Plot seasonal model response by years

Plot seasonal model response by years

Plot seasonal model response by years on a common axis

seasyrplot(dat_in, ...) ## S3 method for class 'tidal' seasyrplot( dat_in, years = NULL, tau = NULL, predicted = TRUE, logspace = TRUE, col_vec = NULL, grids = TRUE, pretty = TRUE, lwd = 0.5, alpha = 1, ... ) ## S3 method for class 'tidalmean' seasyrplot( dat_in, years = NULL, tau = NULL, predicted = TRUE, logspace = TRUE, col_vec = NULL, grids = TRUE, pretty = TRUE, lwd = 0.5, alpha = 1, ... )

Arguments

  • dat_in: input tidal or tidalmean object
  • ...: arguments passed to other methods
  • years: numeric vector of years to plot
  • tau: numeric vector of quantiles to plot, defaults to all in object if not supplied
  • predicted: logical indicating if standard predicted values are plotted, default TRUE, otherwise normalized predictions are plotted
  • logspace: logical indicating if plots are in log space
  • col_vec: chr string of plot colors to use, passed to gradcols. Any color palette from RColorBrewer can be used as a named input. Palettes from grDevices must be supplied as the returned string of colors for each palette.
  • grids: logical indicating if grid lines are present
  • pretty: logical indicating if my subjective idea of plot aesthetics is applied, otherwise the ggplot default themes are used
  • lwd: numeric value indicating width of lines
  • alpha: numeric value indicating transparency of points or lines

Returns

A ggplot object that can be further modified

Details

The plot is similar to that produced by seasplot except the model estimates are plotted for each year as connected lines, as compared to loess lines fit to the model results. seasyrplot is also similar to sliceplot except the x-axis and legend grouping variable are flipped. This is useful for evaluating between-year differences in seasonal trends.

Multiple predictions per month are averaged for a smoother plot.

Note that the year variable used for color mapping is treated as a continuous variable although it is an integer by definition.

Examples

## load a fitted tidal object data(tidfit) # plot using defaults seasyrplot(tidfit) # get the same plot but use default ggplot settings seasyrplot(tidfit, pretty = FALSE) # plot specific quantiles seasyrplot(tidfit, tau = c(0.9)) # plot the normalized predictions seasyrplot(tidfit, predicted = FALSE) # modify the plot as needed using ggplot scales, etc. library(ggplot2) seasyrplot(tidfit, pretty = FALSE, linetype = 'dashed') + theme_classic() + scale_y_continuous( 'Chlorophyll', limits = c(0, 5) ) # plot a tidalmean object data(tidfitmean) seasyrplot(tidfitmean)

See Also

seasplot, sliceplot

  • Maintainer: Marcus W. Beck
  • License: CC0
  • Last published: 2023-10-20

Useful links