Plot scalar values as points.
plot_scalar_points(data, x, y, horiz = NULL, horiz2 = NULL,
vert = NULL, vert2 = NULL, color = NULL, relative.error = FALSE,
axes.free = TRUE, print = TRUE)
A valid data frame containing scalar or timeseries values
from a ss3sim simulation. That data are generated from
get_results_all
.
A character string denoting which column to use as the x variable. Column should be a factor (e.g. "F" or "species").
A character string denoting which column to use as the y variable. Must be a numeric column.
A character string denoting which column to use as
the first (horiz
) and second (horiz2
) level of faceting in
the horizontal direction. E.g. "M" or "species". A value of NULL (default)
indicates no faceting.
A character string denoting which column to use as
the first (vert
) and second (vert2
) level of faceting in
the vertical direction. E.g. "M" or "species". A value of NULL (default)
indicates no faceting.
A character string denoting which column to use to map color. Not valid for boxplot functions. Useful for looking at EM performance criteria against other dimensions of the EM or OM. See example below for how to merge in a metric from a scalar dataset to a ts dataset.
Boolean for whether the y-axis should be
interpreted as relative error. If TRUE
, ylim
is set to
c(-1,1)
, the y axis label is changed automatically, and a
red line at y=0 is added.
Boolean for whether the y-axis scales should be free
in facet_grid
.
A logical for whether the plot is printed or not.
These functions print the ggplot
object, but
also return it invisibly for saving or printing again later.
The ss3sim plotting functions are simply
wrappers for ggplot2 code, specific to the output from
ss3sim simulation scalar and timeseries (ts) objects. They are
designed to quickly explore simulation output, rather than
publication-level figures. The functions use the aes_string
function within ggplot2 such that arguments are passed as
characters that refer to columns of data
.
Note that there are some subtle differences between the
functions. Scalar plots require a value for x
, while for ts plots
x
is invalid because it is fixed internally as 'year', since it
makes no sense to use another column. Boxplots cannot have a color
mapped to them like points or lines, and thus color
is not a
valid argument. The ts point and line plots are grouped internally by
'ID', which is a combination of scenario and iteration.
# NOT RUN {
scalar_dat$depletion <- with(scalar_dat,
(depletion_om - depletion_em) / depletion_om)
plot_scalar_points(scalar_dat, x = "E", y = "depletion", horiz = 'D',
color = "max_grad", relative.error = TRUE)
# }
Run the code above in your browser using DataLab