## PLOT POPULATION GRAPHS ################## PARAMETERS TO SET \data_root = "/home/matt/swarm/seagrass99/tests/" \pop_append = "/outputs/pop_data/" query \test_dir "Input: Model test run data directory (name only)" ("defaults") \pop_dir = "\data_root\test_dir\pop_append" ################## PROCESS PARAMETERS \basename = "pop_plots_" \suffix = ".eps" \fileout = "\basename\test_dir\suffix" set postscript filename \fileout ##################################### # these are equal for all plots set page portrait set tics in set font to Helvetica set clip on ########## set up some variables ########## x-margins for 6 plots (3 rows, 2 columns) each 6x6 cm .xsize. = 6.0 .ysize. = 5.0 ## margin set-up .xbase. = 3.5 # LH margin .ybase. = 21.5 # base-line of top row .xstep. = 7.0 # step between columns .ystep. = -6.0 # step between rows ################################################################# ### New fuction to set the position current plot panel ### on a multi-panel page. e.g., 3 rows, 2 columns `SetPanel .row. .col.' In a multi-panel page, set the current panel to: row = .row. and column = .col. The variables: .xbase., .ybase., .xstep. and .ystep. must be previously defined and set. { .row. = \.word1. .col. = \.word2. .left. = {rpn .xstep. .col. * .xbase. +} .right. = {rpn .left. .xsize. +} .base. = {rpn .ystep. .row. * .ybase. +} .top. = {rpn .base. .ysize. +} } ################################################################# ## the population graphs data filenames \pos = "pos" \amp = "amp" \het = "het" \pop = "_pop" \loss = "_loss" \rec = "_recruits" \new = "_new" set page portrait # these are equal for all plots set tic size 0.20 set tics in set font to Helvetica ## set up some variables ######################################################################## ## PANEL 1 : top left : (0,0) SetPanel 0 0 ################# TOTAL POPULATION -- area corrected ######################### CALCULATE AXES ############################## \file = "\pop_dir\pos\pop" \maxtime = system \.awk. \ '{ nlines++ } END { print nlines }' "\file" show "max time is \maxtime" \maxpos = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "max pos is \maxpos" \file = "\pop_dir\amp\pop" \maxamp = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "max amp is \maxamp" \file = "\pop_dir\het\pop" \maxhet = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "max het is \maxhet" if {rpn \maxamp \maxpos >} \maxpop = "\maxpos" else \maxpop = "\maxamp" end if show "max pop is \maxpop" if {rpn \maxpop \maxhet >} \maxpop = "\maxhet" end if show "max pop is \maxpop" ######################################################################## set x margin .left. set y margin .base. set x size .xsize. set y size .ysize. set tics out set font size 8 set x name "Time" set y name "Pixels, (0.01sqM)" set axes style 1 open "\pop_dir\pos\pop" read columns y #show columns statistics #show variables set x axis 0 {rpn \maxtime 10 / \maxtime +} 20 5 set y axis 0 {rpn \maxpop 8 / \maxpop +} 5000 1000 set line width 0.4 set dash 0 draw curve set graylevel 0 set font size 12 draw label for last curve "$P$" delete columns open "\pop_dir\amp\pop" read columns y set line width 0.6 set graylevel 0.2 set dash 10 draw curve set graylevel 0 set font size 12 draw label for last curve "$A$" delete columns \file = "\pop_dir\het\pop" open "\pop_dir\het\pop" read columns y #show columns statistics set line width 0.6 set graylevel 0.4 set dash 13 draw curve set graylevel 0 \lasthet = system \.awk. \ 'BEGIN { xval = 0 } \ { if ($1 > 0 ) xval = NR } \ END { print xval }' "\file" show "\lasthet" ..lastx.. = \lasthet ..lasty.. = {rpn \maxhet 12 / ..lasty.. +} set font size 12 draw label for last curve "$H$" delete columns set font size 11 set font to Helvetica set dash 0 draw label "Total Species Area" \ at {rpn .left. 1 +} {rpn .top. 0.6 -} cm ######################################################################### ## PANEL 2 : top right : (0,1) SetPanel 0 1 ######################### POPULATION LOSSES ############################ ######################### CALCULATE AXES ############################## \file = "\pop_dir\pos\loss" \maxtime = system \.awk. \ '{ nlines++ } END { print nlines }' "\file" show "\maxtime" \maxpos = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxpos" \file = "\pop_dir\amp\loss" \maxamp = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxamp" \file = "\pop_dir\het\loss" \maxhet = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxhet" if {rpn \maxamp \maxpos >} \maxloss = "\maxpos" else \maxloss = "\maxamp" end if show "max loss is \maxloss" if {rpn \maxloss \maxhet >} \maxloss = "\maxhet" end if show "max loss is \maxloss" ######################################################################## ######################## SET UP THE LAYOUT ############################ set x margin .left. set y margin .base. set x size .xsize. set y size .ysize. set tics out set font size 8 set x name "Time" set y name "" set axes style 1 open "\pop_dir\pos\loss" read columns y #show columns statistics #show variables set x axis 0 {rpn \maxtime 10 / \maxtime +} 20 5 set y axis 0 {rpn \maxloss 8 / \maxloss +} 2500 500 #set y axis 0 {rpn \maxloss 10 / \maxloss +} {rpn \maxpop 5 / 10 / ceil 10 *} set line width 0.4 set dash 0 draw curve set graylevel 0 set font size 12 draw label for last curve "$P$" delete columns open "\pop_dir\amp\loss" read columns y set line width 0.6 set graylevel 0.2 set dash 10 draw curve set graylevel 0 set font size 12 draw label for last curve "$A$" delete columns \file = "\pop_dir\het\loss" open "\pop_dir\het\loss" read columns y set line width 0.6 set graylevel 0.4 set dash 13 draw curve set graylevel 0 \lasthet = system \.awk. \ 'BEGIN { xval = 0 } \ { if ($1 > 0 ) xval = NR } \ END { print xval }' "\file" show "\lasthet" ..lastx.. = \lasthet ..lasty.. = {rpn \maxhet 12 / ..lasty.. +} set font size 12 draw label for last curve "$H$" delete columns set font size 11 set font to Helvetica set dash 0 draw label "Winter Area Losses" \ at {rpn .left. 1.4 +} {rpn .top. 0.4 -} cm ######################################################################### ######################################################################### ## PANEL 3 : mid left : (1,0) SetPanel 1 0 ######################### NEW RAMETS (rhizome extension) ############## ######################### CALCULATE AXES ############################## \file = "\pop_dir\pos\new" \maxtime = system \.awk. \ '{ nlines++ } END { print nlines }' "\file" show "\maxtime" \maxpos = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxpos" \file = "\pop_dir\amp\new" \maxamp = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxamp" \file = "\pop_dir\het\new" \maxhet = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxhet" if {rpn \maxamp \maxpos >} \maxnew = "\maxpos" else \maxnew = "\maxamp" end if show "max new is \maxnew" if {rpn \maxnew \maxhet >} \maxnew = "\maxhet" end if show "max new is \maxnew" ######################################################################## ######################## SET UP THE LAYOUT ############################ set x margin .left. set y margin .base. set x size .xsize. set y size .ysize. set tics out set font size 8 set x name "Time" set y name "Pixels, (0.01sqM)" set axes style 1 open "\pop_dir\pos\new" read columns y #show columns statistics #show variables set x axis 0 {rpn \maxtime 10 / \maxtime +} 20 5 set y axis 0 {rpn \maxnew 8 / \maxnew +} 2500 500 #set y axis 0 {rpn \maxnew 10 / \maxnew +} {rpn \maxpop 5 / 10 / ceil 10 *} set line width 0.4 set dash 0 draw curve set graylevel 0 set font size 12 draw label for last curve "$P$" delete columns open "\pop_dir\amp\new" read columns y set line width 0.6 set graylevel 0.2 set dash 10 draw curve set graylevel 0 set font size 12 draw label for last curve "$A$" delete columns \file = "\pop_dir\het\new" open "\pop_dir\het\new" read columns y set line width 0.6 set graylevel 0.4 set dash 13 draw curve set graylevel 0 \lasthet = system \.awk. \ 'BEGIN { xval = 0 } \ { if ($1 > 0 ) xval = NR } \ END { print xval }' "\file" show "\lasthet" ..lastx.. = \lasthet ..lasty.. = {rpn \maxhet 12 / ..lasty.. +} set font size 12 draw label for last curve "$H$" delete columns set font size 11 set font to Helvetica set dash 0 draw label "New Rhizome Shoots" \ at {rpn .left. 1.4 +} {rpn .top. 0.4 -} cm ######################################################################### ## PANEL 4 : mid roght : (1,1) SetPanel 1 1 ######################### SEED RECRUITS ############## ######################### CALCULATE AXES ############################## \file = "\pop_dir\pos\rec" \maxtime = system \.awk. \ '{ nlines++ } END { print nlines }' "\file" show "\maxtime" \maxpos = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxpos" \file = "\pop_dir\amp\rec" \maxamp = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxamp" \file = "\pop_dir\het\rec" \maxhet = system \.awk. \ 'BEGIN { pop = 0 } \ { if ($1 > pop) pop = $1 } \ END { print pop }' "\file" show "\maxhet" if {rpn \maxamp \maxpos >} \maxrec = "\maxpos" else \maxrec = "\maxamp" end if show "max recruits is \maxrec" if {rpn \maxrec \maxhet >} \maxrec = "\maxhet" end if show "max recruits is \maxrec" ######################################################################## ######################## SET UP THE LAYOUT ############################ set x margin .left. set y margin .base. set x size .xsize. set y size .ysize. set tics out set font size 8 set x name "Time" set y name "" set axes style 1 open "\pop_dir\pos\rec" read columns y #show columns statistics #show variables .inc1. = {rpn \maxrec 5 / 100 / ceil 100 *} .inc2. = {rpn .inc1. 4 /} .end. = {rpn \maxrec 8 / \maxrec +} set x axis 0 {rpn \maxtime 10 / \maxtime +} 20 5 #set y axis 0 {rpn \maxrec 8 / \maxrec +} 2500 500 set y axis 0 .end. .inc1. .inc2. set line width 0.4 set dash 0 draw curve set graylevel 0 set font size 12 draw label for last curve "$P$" delete columns open "\pop_dir\amp\rec" read columns y set line width 0.6 set graylevel 0.2 set dash 10 draw curve set graylevel 0 set font size 12 draw label for last curve "$A$" delete columns \file = "\pop_dir\het\rec" open "\pop_dir\het\rec" read columns y set line width 0.6 set graylevel 0.4 set dash 13 draw curve set graylevel 0 \lasthet = system \.awk. \ 'BEGIN { xval = 0 } \ { if ($1 > 0 ) xval = NR } \ END { print xval }' "\file" show "\lasthet" ..lastx.. = \lasthet ..lasty.. = {rpn \maxhet 12 / ..lasty.. +} set font size 12 draw label for last curve "$H$" delete columns set font size 11 set font to Helvetica set dash 0 draw label "Seed Recruits" \ at {rpn .left. 1.4 +} {rpn .top. 0.4 -} cm ######################################################################### ######################################################################### ## PANEL 5 : bot left : (2,0) SetPanel 2 0 ################ LEGEND set font size 12 draw label "$P$ : $Posidonia$" \ at {rpn .left. 1.0 +} {rpn .base. 4.0 +} cm draw label "$A$ : $Amphibolis$" \ at {rpn .left. 1.0 +} {rpn .base. 3.5 +} cm draw label "$H$ : $Heterozostera$" \ at {rpn .left. 1.0 +} {rpn .base. 3.0 +} cm quit