R/plotfigure_function.R

library(ggplot2)
library(tidyverse)
library(dplyr)



#' Produce Plots
#'
#'Takes in the runnames of all runsettings to compare, and the select parameters; plots comparisons across simulation in posterior estimates, and plots
#'of distributions of median estimates across run settings as well as bias.
#'
#' @param runnames settings of the different runs to compare
#' @param plotpars selected parameters to plot
#' @param outext the output folder filepath
#' @param fig.dir figure directory to save the figures in pdf form
#'
#' @return Comparison plots across different run settings that look at the params selected for plotting.
#' @export
#'
#' @examples
#'
#'
#'
#'
#'
produce_plots <- function(runnames, plotpars, fig.dir ){
  outext <-  paste(getwd(), "/Output/", sep="")
  dftot <- readRDS(paste(outext, "DFtot.RDS", sep=""))
  dfsub = readRDS(paste(outext, "DFsubset.RDS", sep=""))

pdf(paste(fig.dir, "SimulationResults.pdf", sep=""))
  plot_nsim(df = dfsub)
dev.off()





pdf(paste(fig.dir, "MedianEst.pdf", sep=""))
  plot_box(df = dfsub, pars = plotpars)
dev.off()



pdf(paste(fig.dir, "Time Series Plots.pdf", sep=""))
plot_ts(df=dftot, Nyears = 15)
dev.off()
}#end function
Enpeterson/outputsim documentation built on May 24, 2019, 9:53 a.m.