seasyrplot {WRTDStidal} | R Documentation |
Plot seasonal model response by years
Description
Plot seasonal model response by years on a common axis
Usage
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 |
logspace |
logical indicating if plots are in log space |
col_vec |
chr string of plot colors to use, passed to |
grids |
logical indicating if grid lines are present |
pretty |
logical indicating if my subjective idea of plot aesthetics is applied, otherwise the |
lwd |
numeric value indicating width of lines |
alpha |
numeric value indicating transparency of points or lines |
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.
Value
A ggplot
object that can be further modified
See Also
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)