Skip to content

Commit

Permalink
@MOshima-PIFSC requested changes #94
Browse files Browse the repository at this point in the history
  • Loading branch information
efletcherPIFSC committed Jul 31, 2023
2 parents c6f5bb5 + 0e7b097 commit 57bb879
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 191 deletions.
17 changes: 8 additions & 9 deletions R/SSplotEnsemble.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Model ensemble plots
#'
#' Plots model ensembles and forecasts with uncertainty represented by MVLN or
#' Plots model ensembles and forecasts with uncertainty represented by MVLN or
#' MCMC posteriors
#'
#' @param kb `kb` type output created by `SSdeltaMVLN()`
Expand All @@ -9,19 +9,19 @@
#' \item `"stock"` Fish Population
#' \item `"harvest"` Harvest Rate
#' \item `"SSB"` Spawning Stock Biomass
#' \item `"F"` Fishing Mortality
#' \item `"F"` Fishing Mortality
#' \item `"Recr"` Recruitment
#' \item `"Catch"` Total Catch
#' }
#' }
#' @param models option to manually subset the models in `kb[["run"]]`
#' @param quantiles quantiles for uncertainty in plots. Input as a list,
#' @param quantiles quantiles for uncertainty in plots. Input as a list,
#' default is the 95TH percentile: `list(c(0.025, 0.975))`
#' @param ylabs y-axis labels for quants
#' @param shadealpha Transparency adjustment used to make uncertainty regions,
#' @param shadealpha Transparency adjustment used to make uncertainty regions,
#' default is 0.3
#' @param indexQlabel TRUE/FALSE include labels for indices. Default is TRUE
#' @param indexQlabel TRUE/FALSE include labels for indices. Default is TRUE
#' (currently not used)
#' @param indexQdigits Number of significant digits for catchability in legend.
#' @param indexQdigits Number of significant digits for catchability in legend.
#' Default is 4
#' @param endyrvec Optional single year or vector of years representing the
#' final year of values to show for each model. By `"default"` it is set to the
Expand Down Expand Up @@ -97,8 +97,7 @@ SSplotEnsemble <- function(kb,
mcmcVec = FALSE,
indexQlabel = TRUE,
indexQdigits = 4,
legendindex = NULL) {

legendindex = NULL) {
# plot different fits to a single index of abundance

# Parameter DEPRECATION checks
Expand Down
221 changes: 108 additions & 113 deletions R/SSplotGeneric.R
Original file line number Diff line number Diff line change
@@ -1,84 +1,82 @@


#' Generic SSplot function
#'
#' Generalized version of ss3diags SSplots functions. Not intended for
#'
#' Generalized version of ss3diags SSplots functions. Not intended for
#' production
#'
#' @param pwidth
#'
#' @param pwidth
#' Default width of plot printed to plot in units of `punits`
#'
#' @param pheight
#'
#' @param pheight
#' Height of plot printed to plot in units of `punits `
#'
#' @param punits
#'
#' @param punits
#' Measurement units for `pwidth` and `pheight`. Default is `"in"`.
#' \itemize{
#' \item `"px"` (pixels)
#' \item `"in"` (inches)
#' \item `"cm"` (centimeters)
#' \item `"mm"` (millimeters)
#' }
#'
#' @param res
#'
#' @param res
#' Resolution for plots printed to files.
#'
#' @param ptsize
#'
#' @param ptsize
#' Point size for plotted text in plots printed in files. See `help("png")`
#' for more details
#'
#' @param cex.main
#'
#' @param cex.main
#' Character expansion for plot titles.
#'
#' @param plotdir
#' Directory where output plot file will be written. By default,
#'
#' @param plotdir
#' Directory where output plot file will be written. By default,
#' it will be the directory where the model was run.
#'
#' @param filenameprefix
#'
#' @param filenameprefix
#' Additional text to append to output plot file name.
#' It will be separated from default name by an underscore.
#'
#' @param par
#' A numerical vector of the form c(bottom, left, top, right) which
#' gives the number of lines of margin to be specified on the four sides of
#' the plot,which is passed to `par()`. Entering `NULL` passes plot's default
#'
#' @param par
#' A numerical vector of the form c(bottom, left, top, right) which
#' gives the number of lines of margin to be specified on the four sides of
#' the plot,which is passed to `par()`. Entering `NULL` passes plot's default
#' `par()` values (which depends on whether the main title is included or not)
#'
#' @param verbose
#'
#' @param verbose
#' Flag to print additional diagnostic messages to R console
#'
#' @param plot
#' DEPRECATED. By default, TRUE, Plots (and subplots) are drawn to the
#' plot device. The option to explicitly disable this option (FALSE), is not
#'
#' @param plot
#' DEPRECATED. By default, TRUE, Plots (and subplots) are drawn to the
#' plot device. The option to explicitly disable this option (FALSE), is not
#' implemented. This option flag will be defunct in a future version
#'
#' @param print
#'
#' @param print
#' DEPRECATED, please use `print_plot`.
#'
#' @param print_plot
#'
#' @param print_plot
#' Flag to enable plot graphic device to print to PNG or PNG files.
#'
#' @param png
#'
#' @param png
#' DEPRECATED. Please use `use_png`.
#'
#' @param use_png
#'
#' @param use_png
#' Enables plots to be generated to PNG files. Defaults to print value
#'
#' @param pdf
#'
#' @param pdf
#' DEPRECATED. Please use `use_pdf`.
#'
#' @param use_pdf
#'
#' @param use_pdf
#' Enables plots to be generated to pdf file.
#'
#' @param new
#'
#' @param new
#' Deprecated. New plot windows are created by default (TRUE), and the
#' option to disable this, via FALSE, is unused.
#'
#' @param add
#'
#' @param add
#' suppresses `par()` to create multiplot figs
#'
#'
#' @keywords internal
#'
#'
SSplotGeneric <- function(pwidth = 6.5,
pheight = 5.0,
punits = "in",
Expand All @@ -98,45 +96,44 @@ SSplotGeneric <- function(pwidth = 6.5,
use_pdf = FALSE,
new = TRUE,
add = FALSE) {

stop("SSplotGeneric not implemented")
}


#' Legend parameters for Generic SSplot
#' Legend parameters for Generic SSplot
#'
#' Generalized version of ss3diags SSplots functions specfic to plot legend
#' Generalized version of ss3diags SSplots functions specfic to plot legend
#' parameters. Not intended for production.
#'
#' @param legend
#' @param legend
#' Flag to enable legend to plot. TRUE by default.
#'
#' @param legendlabels
#'
#' @param legendlabels
#' Optional vector of labels to include in legend.
#'
#' @param legendloc
#' Location of legend. Either a string like "topleft" or a vector of two
#'
#' @param legendloc
#' Location of legend. Either a string like "topleft" or a vector of two
#' numeric values representing the fraction of the maximum in the x and y
#' dimensions, respectively. See `help("legend")` for more info on the
#' dimensions, respectively. See `help("legend")` for more info on the
#' string options.
#'
#' @param legendorder
#' Optional vector of model numbers that can be used to have the legend
#'
#' @param legendorder
#' Optional vector of model numbers that can be used to have the legend
#' display the model names in an order that is different than that
#' which is represented in the summary input object.
#'
#' @param legendncol
#'
#' @param legendncol
#' Number of columns for the legend.
#'
#' @param legendcex
#'
#' @param legendcex
#' Allows to adjust legend cex
#'
#' @param legendsp
#'
#' @param legendsp
#' Space between legend labels
#'
#' @param legendindex
#'
#' @param legendindex
#' Allows to add legend for selected indices (plots)
#'
#'
#' @keywords internal
#'
SSplotGenericLegend <- function(legend = TRUE,
Expand All @@ -147,7 +144,6 @@ SSplotGenericLegend <- function(legend = TRUE,
legendcex = 1,
legendsp = 0.9,
legendindex = NULL) {

stop("SSplotGenericLegend not implemented")
}

Expand All @@ -157,44 +153,44 @@ SSplotGenericLegend <- function(legend = TRUE,
#' Generalized version of ss3diags SSplots functions to specify to `par()` or
#' to pass plot attributes. Not intended for production.
#'
#' @param col
#' @param col
#' Optional vector of colors to be used for lines. Input NULL
#'
#' @param pch
#'
#' @param pch
#' Optional vector of plot character values
#'
#' @param lty
#'
#' @param lty
#' Optional vector of line types
#'
#' @param lwd
#'
#' @param lwd
#' Optional vector of line widths
#'
#' @param tickEndYr
#' [Logical][base::logical] flag: set TRUE or FALSE to switch to turn
#'
#' @param tickEndYr
#' [Logical][base::logical] flag: set TRUE or FALSE to switch to turn
#' on/off extra axis mark at final year in timeseries plots.
#'
#' @param ylimAdj
#'
#' @param ylimAdj
#' Multiplier for ylim parameter. Allows additional white space.
#'
#' @param xlim
#' Optional, years to use for x-axis. Default value NULL (or "default"),
#'
#' @param xlim
#' Optional, years to use for x-axis. Default value NULL (or "default"),
#' uses all years available.
#'
#' @param xaxs
#'
#' @param xaxs
#' Choice of xaxs parameter See `?par` for more info.
#'
#' @param yaxs
#'
#' @param yaxs
#' Choice of yaxs parameter. See `?par` for more info.
#'
#' @param xylabs
#' [Logical][base::logical] flag: set TRUE or FALSE to include x- and
#'
#' @param xylabs
#' [Logical][base::logical] flag: set TRUE or FALSE to include x- and
#' y-axis labels to the plot. Defaults to TRUE
#'
#' @param type
#'
#' @param type
#' The type of plot to be drawn. For more details, see [`plot`][base::plot].
#'
#'
#' @keywords internal
#'
#'
SSplotGenericPar <- function(col = NULL,
pch = NULL,
lty = 1,
Expand All @@ -215,27 +211,26 @@ SSplotGenericPar <- function(col = NULL,
#' Generalized version of ss3diags SSplots functions to specify uncertainty.
#' Not intended for production.
#'
#' @param uncertainty
#' @param uncertainty
#' Logical flag to enable plots with uncertainty intervals. Either a single
#' TRUE/FALSE value, or a vector of TRUE/FALSE values around SSB or F
#' estimated timeseries, or a set of integers corresponding to
#' TRUE/FALSE value, or a vector of TRUE/FALSE values around SSB or F
#' estimated timeseries, or a set of integers corresponding to
#' the choice of models.
#'
#' @param mcmcVec
#'
#' @param mcmcVec
#' Logical vector of TRUE/FALSE values (or single value) indicating
#' whether input values are from MCMC or to use normal distribution around
#' MLE.
#'
#'
#' @param models Optional subset of the models of `summaryoutput` (or a similar
#' field with a different name): a list created by the function
#' [r4ss::SSsummarize]. Either `"all"` or a vector of numbers indicating
#' field with a different name): a list created by the function
#' [r4ss::SSsummarize]. Either `"all"` or a vector of numbers indicating
#' columns in summary tables.
#'
#'
#' @keywords internal
#'
SSplotGenericUncertainty <- function (uncertainty = TRUE,
mcmcVec = FALSE,
models = "all") {

SSplotGenericUncertainty <- function(uncertainty = TRUE,
mcmcVec = FALSE,
models = "all") {
stop("SSplotGenericUncertainty not implemented")
}
}
Loading

0 comments on commit 57bb879

Please sign in to comment.