#!/bin/csh

set GRAPH = (xgraph style=n width=800 height=400 linewidth=2 grid1=dot grid2=dot label1=Time \
             linecolor=0,2,3,4,0,2,3,4 mark=8 marksize=6)

cc wikipedia_hubbert.c

echo Plot Hubbert and Total
a.out 100 | awk '{print $1,4*$2}'  | a2b  >/tmp/j
a.out 100 | awk '{print $1,$3}'    | a2b >>/tmp/j
</tmp/j $GRAPH nplot=2 n=25 nplot=8 x2end=1.01  label2="Peak and Total" \
title="Hubbert's Peak and Total Production Color implies time: Black then Red then Green then Blue" &
sleep 1

echo Plot log Hubbert and log Total
a.out 100 | awk '{print $1,log(4*$2)}' | a2b  >/tmp/j
a.out 100 | awk '{print $1,log($3)}'   | a2b >>/tmp/j
</tmp/j $GRAPH nplot=2 n=25 nplot=8 label2="Log Peak and Total" \
title="Hubbert's Peak and Total Production Color implies time: Black then Red then Green then Blue" &
sleep 1

echo Log-Log Cross plot Hubbert and Total
a.out 100 | awk '{print log($3),log(4*$2)}'  | a2b  >/tmp/j
</tmp/j $GRAPH label1=logTotalProductionSoFar label2=logHubbertPeak n=25 nplot=4 x2end=0.01 \
title="Hubbert's Peak and Total Production Color implies time: Black then Red then Green then Blue" &
sleep 1

\rm a.out
