#################################################################################################### # SOURCE FILE TO RUN ALL PLOT-SCRIPTS # From this source-script we can execute the 3 kinds of plots groups (diagnosis, results and # projections) together or separately in one or three pdf documents selecting pdfPlot TRUE or FALSE # created: camilo.saavedra@vi.ieo.es (02/07/2013) #################################################################################################### # VERY IMPORTANT: Set working directory to source file location # setwd("~/scripts/") # Select some figures before plotting. Name and number of documents withing plots runN <- "1" # Ordinal number of the run load("R.data/annualUpdate.RData") # Load annual updated data used for pdf names ##################### CHOOSE HOW DO YOU WANT TO PRINT YOUR PLOTS ################################### # Executing pdf objects: The four pdf objects must be executed pdfPlot <- FALSE # If TRUE writes all plots in one pdf, if FALSE writes each plot in various pdf pdfDiag <- FALSE # If TRUE writes all diagnosis plots in one pdf, if FALSE writes in various pdf pdfResu <- FALSE # If TRUE writes all results plots in one pdf, if FALSE writes in various pdf pdfPrj <- FALSE # If TRUE writes all projections plots in one pdf, if FALSE writes in various pdf # Check and transform all pdf objects to FALSE if pdfPlot is TRUE if(pdfPlot) {pdfDiag <- FALSE; pdfResu <- FALSE; pdfProj <- FALSE} ################################## PLOTS ########################################################### # Select the working directory to execute the next source scripts wd <- getwd() # Opens pdf document if we want to plot all figures in the same document (pdfPlot=TRUE) if(pdfPlot) { plotName <- paste("WGHMM", substr((lastYear+1), 3,4), ".", runN, sep="") # pdf name pdf(file=paste("../plots/", plotName, ".pdf", sep=""), height=7, width=10.5)} ############################### Diagnosis plots #################################################### setwd(paste(wd, "/scripts.diag", sep="")) if(pdfDiag) { plotName <- paste("WGHMM", substr((lastYear+1), 3,4), ".", runN, sep="") # pdf name pdf(file=paste("../../plots/plots.diag/", plotName, ".Diag",".pdf", sep=""), height=7, width=10.5)} ##### Convergence plots ##### #source ("plot_Sensitivity.r") # input function: "../functions/pdfPlot.r" # input file: "../../model/sens.txt" # output plot: "../../plots/plots.diag/plot_SensFree.pdf" # output plot: "../../plots/plots.diag/plot_SensFix.pdf" ##### Summary of likelihood scores ##### source ("plot_LikeSummary.r") # input function: "../functions/pdfPlot.r" # input file: "../../out/hke.lik.summ.out" # output plot: "../../plots/plots.diag/plot_LikeWeight.pdf" # output plot: "../../plots/plots.diag/plot_LikeSumm.pdf" ##### Catchability in abundance indices (sp and pt surveys) by 15 cm length class ##### source ("plot_INDEX.r") # input function: "../functions/pdfPlot.r" # input file for every length range (N = 1:3 ranges): "../../out/SpIndex15.N.print" # output plot: "../plots/plots.diag/plot_INDEX-ObsExp.pdf" ##### Catchability in abundance indices (sp and pt) by 15cm length class (25-40; 40-55; 55-70) ##### source ("plot_CPUE.r") # input function: "../functions/pdfPlot.r" # input file: "../../out/SpCPUE15cm.1.print" # input file: "../../out/SpCPUE15cm.2.print" # input file: "../../out/SpCPUE15cm.3.print" # input file: "../../data/ld-15cm-sp_cpue.in" # input file: "../../out/Sp85CPUE15cm.1.print" # input file: "../../out/Sp85CPUE15cm.2.print" # input file: "../../out/Sp85CPUE15cm.3.print" # input file: "../../data/ld-15cm-sp_cpue85.in" # input file: "../../out/PtCPUE15cm.1.print" # input file: "../../out/PtCPUE15cm.2.print" # input file: "../../out/PtCPUE15cm.3.print" # input file: "../../data/ld-15cm-pt_cpue.in" # output plot: "../plots/plots.diag/plot_CPUE-ObsExp.pdf" ##### Landings observed and expected (histogram and density plots) ##### source ("plot_ObsExp.r") # input function: "../functions/pdfPlot.r" # input file: "../../out/expected.landings.ld" # input file: "../../out/expected.landings1.ld" # input file: "../../out/expected.cdlandings.ld" # input file: "../../out/expected.discards.ld" # input file: "../../out/expected-sp_surv.ld" # input file: "../../out/expected-pt_surv.ld" # input file: "../../out/expected-cdAut_surv.ld" # input file: "../../data/ld-2cm-land82-93.in" # input file: "../../data/ld-2cm-land94-end.in" # input file: "../../data/ld-2cm-land-Cd94-04.in" # input file: "../../data/ld-2cm-disc.in" # input file: "../../data/ld-2cm-sp-surv.in" # input file: "../../data/ld-2cm-cdAut-surv.in" # input file: "../../data/ld-2cm-pt-surv.in" # output plot: "../../plots/plots.diag/plot_ObsExp.pdf" # output plot: "../../plots/plots.diag/plot_ObsExpSurvey.pdf" ##### Landings observed and expected (bubles plots) ##### source ("plot_ObsExpBuble.r") # input function: "../functions/pdfPlot.r" # input file: "../../model/hke.likelihood" # input file: "../../out/expected.landings1.ld" # input file: "../../out/expected.landings.ld" # input file: "../../out/expected.cdlandings.ld" # input file: "../../out/expected.discards.ld" # input file: "../../out/expected-sp_surv.ld" # input file: "../../out/expected-pt_surv.ld" # input file: "../../out/expected-cdAut_surv.ld" # output plot: "../../plots/plots.diag/plots_ObsExpBuble.pdf" # output plot: "../../plots/plots.diag/plots_ObsExpBubleSurvey.pdf" if (pdfDiag){dev.off()} setwd(wd) ############################# Results plots ######################################################## setwd(paste(wd, "/scripts.results", sep="")) if(pdfResu) { plotName <- paste("WGHMM", substr((lastYear+1), 3,4), ".", runN, sep="") # pdf name pdf(file=paste("../../plots/plots.results/", plotName, ".Results",".pdf", sep=""), height=7, width=10.5)} ##### PLot selectivity for sp and pt survey and for total catches ###### #source("plot_Selectivity.r") # input function: "../functions/pdfPlot.r" # input function: "../functions/logit.r" # input function: "../functions/andersen.r" # input file: "../../model/params.out" # output file: "../../plots/plots.results/plot_SelectPattern.pdf" ##### PLot growth curve ##### source("plot_Growth.r") # input function: "../functions/pdfPlot.r" # source file: "../functions/vonb.r" # input file: "../../model/params.out" # output file: "../../plots/plots.results/plot_GrowthVB.pdf" ##### Summary tables hkeLen and hkeAge ##### source("table_Summary.r") # input data: "../R.data/annualUpdate.RData" # input file: "../../out/hkeLenN.out" # input file: "../../out/hkeLenC.out" # input file: "../../out/hkeLenL.out" # input file: "../../out/hkeLenD.out" # input file: "../../data/RData.matOgives" # input file: "../../out/hkeAgeN.out" # input file: "../../out/hkeAgeC.out" # input file: "../../out/hkeAgeL.out" # input file: "../../out/hkeAgeD.out" # input file: "../../out/hke.std.out" # output data: "../R.data/hakeLen.RData" # output data: "../R.data/hakeAge.RData" # output file: "../../tables/tables.results/hkeLen.csv" # output file: "../../tables/tables.results/hkeAge.csv" ##### Summary plot Gadget ##### source("plot_Summary.r") # input function: "../functions/pdfPlot.r" # input file: "../../tables/tables.results/hkeLen.csv" # input file: "../../tables/tables.results/hkeAge.csv" # output data: "../R.data/sumDat.RData" # output table: "../../tables/tables.results/sumDat.csv" # output table: "../../tables/tables.results/tab_summary.pdf" # output plot: "../../plots/plots.results/plot_StkRec-Refpts.pdf" # output plot: "../../plots/plots.results/plot_Summary.pdf" # output plot: "../../plots/plots.results/FComp.pdf" ##### F by quarter ##### source("plot_FQuarter.r") # input function: "../functions/pdfPlot.r" # input data: "../R.data/annualUpdate.RData" # input file: "../../out/hkeAgeC.out" # output file: "../../plots/plots.results/plot_FQuarter.pdf" ##### Mean length at age ##### source("plot_LenAtAge.r") # input function: "../functions/pdfPlot.r" # input file: "../../out/hke.std.out" # output plot: "../../plots/plots.results/plot_LengthAtAge.pdf" ##### N and C by length ##### source("plot_ByLength.r") #