Learn R Programming

r4ss (version 1.11)

DoProjectPlots: Make plots from Rebuilder program

Description

Make a set of plots based on output from Andre Punt's Rebuilder program.

Usage

DoProjectPlots(dirn="C:/myfiles/",fileN=c("res.csv"),Titles="",
  ncols=200,Plots=list(1:25),Options=list(c(1:9)),LegLoc="bottomright",
  yearmax=-1,Outlines=c(2,2),OutlineMulti=c(2,2),AllTraj=c(1,2,3,4),
  AllInd=c(1,2,3,4,5,6,7),BioType="Spawning biomass",CatchUnit="(mt)",
  BioUnit="(mt)",BioScalar=1,ColorsUsed="default",Labels="default")

Arguments

dirn
Directory where rebuilder output files are stored.
fileN
Vector of filenames containing rebuilder output. Default=c("res.csv").
Titles
Titles for plots when using multiple filenames. Default="".
ncols
Number of columns to read in output file (fileN). Deafult=200.
Plots
List to get specific plots (currently 1 through 8). Default=list(1:25). If there are multiple files, supply a list of vectors, e.g. list(c(1,5),c(2:5))
Options
List to get specific strategies in the trajectory plots. Default=list(c(1:9)).If there are multiple files, supply a list of vectors, e.g. list(c(1,5),c(2:5))
LegLoc
Location for the legend (for plots with a legend). Default="bottomright".
yearmax
Maximum year to show in the plots. Set negative to show all years. Default=-1.
Outlines
Number of rows, columns for some of the plots. Default=c(2,2).
OutlineMulti
Number of rows, columns for other plots. Default=c(2,2).
AllTraj
Vector of trajectories to show. Default=c(1,2,3,4).
AllInd
Vector of individual plots to show. Default=c(1,2,3,4,5,6,7).
BioType
Label for biomass type. Default="Spawning biomass".
CatchUnit
Units of catch. Default="(mt)".
BioUnit
Units of biomass. Default="(mt)".
BioScalar
Scalar for biomass plot. Default=1.
ColorsUsed
Optional vector for alternative line colors. Default="default".
Labels
Optional vector for alternative legend labels. Default="default".

Examples

Run this code
# example with one file
 DoProjectPlots(dirn="c:/myfiles/", Plots=1:8,
                Options=c(1,2,3,4,5,9), LegLoc="bottomleft")

# example with multiple files
 # Plots - set to get specific plots
 # Options - set to get specific strategies in the trajectory plots

 Titles <- c("Res1","Res2","Res3")
 Plots <- list(c(1:9),c(6:7))
 Options <- list(c(7:9,3),c(5,7))
 DoProjectPlots(fileN=c("res1.csv","res2.csv"),Titles=Titles,Plots=Plots,
                Options=Options,LegLoc="bottomleft",yearmax=-1,
                Outlines=c(2,2),OutlineMulti=c(3,3),AllTraj=c(1:4),
                AllInd=c(1:7),BioType="Spawning numbers",BioUnit="(lb)",
                BioScalar=1000,CatchUnit="(lb)",
                ColorsUse=rep(c("red","blue"),5),
                Labels=c("A","B","C","D","E","F"))

Run the code above in your browser using DataLab