#!/bin/sh # # growthplot -- plot the fetchmail population's growth as a function of time # # Get data from the NEWS file timeseries >/tmp/growthplot$$ grep "^[0-9]" /tmp/growthplot$$ >/tmp/growthnumbers$$ grep "^[0-9.]*.[05].0 " /tmp/growthplot$$ >/tmp/growthmajors$$ sed '/^4.2.9/,$d' </tmp/growthnumbers$$ >/tmp/growthannounce$$ cat >/tmp/growthimage$$ <<EOF set title "Fetchmail project growth history" set xlabel 'Days since baseline' set ylabel 'Participants' set y2label 'Lines of code' set ytics nomirror set y2tics set tics out set autoscale y set y2range [5000:50000] set key bottom right box set terminal gif EOF # OK, now write the event labels ( echo "count=0" echo "breakheight=510" while read version size friends announce total days date do if [ "$version" = '%' ] then legend="$friends $announce $total $days $date" echo "# Associate $lastday to '$legend'" echo "count = count + 1" echo "lastday = $lastday - 5" echo "lasttotal = $lasttotal" echo set arrow \ from lastday, breakheight \ to lastday, lasttotal+50 \ head echo "endx = lastday + 50 + count * 25" echo "endy = breakheight + 50 + count * 50" echo "set arrow \ from lastday, breakheight to endx, endy nohead" echo "set label '$legend' at endx+10, endy" else lastday=$days lasttotal=$total fi done ) </tmp/growthplot$$ >>/tmp/growthimage$$ # OK, now write the major-release labels ( while read version size friends announce total days date do echo "set arrow from $days, $total - 55 to $days, $total - 15 head" echo "set label '$version' at $days - 5, $total - 65" done ) </tmp/growthmajors$$ >>/tmp/growthimage$$ cat >>/tmp/growthimage$$ <<EOF plot [] [0:] '/tmp/growthnumbers$$' using 6:5 \ title "Both lists" with points 3, \ '/tmp/growthannounce$$' using 6:4 \ title "fetchmail-announce" with points 4, \ '/tmp/growthannounce$$' using 6:3 \ title "fetchmail-friends" with points 2, \ '/tmp/growthnumbers$$' using 6:2 axes x1y2 \ title "Lines of code" with points 6 EOF # The gnuplot driver for PNG doesn't do color if gnuplot /tmp/growthimage$$ >growth.gif then gif2png -s -d growth.gif else echo "Plot failed." fi rm -f /tmp/growth* # growthplot ends here