]> Pileus Git - ~andy/fetchmail/blobdiff - growthplot
Doesn't work with 2.3.
[~andy/fetchmail] / growthplot
index 2f1f6cbaf53bd32094cbcaa19e00cb5b3007ec12..1cf0de8360811545b5594212591ccb130cb70ddc 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# growthplot -- plot the fetchmail population's growth as a function of time
+# growthplot -- plot the fetchmail project's growth as a function of time
 #
 
 # Get data from the NEWS file
@@ -9,38 +9,65 @@ 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$$
 
+# gnuplot line styles.  These occasionally change (like beteween 3.5 and 3.7);
+# use "echo "set terminal png color; test" | gnuplot | display - to check.
+blue_boxes=3
+green_crosses=2
+cyan_diamonds=37       # Once purple triangles, but we can't do that anymore
+brown_triangles=23
+
 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
+set terminal png color
 
 EOF
 
 # OK, now write the event labels
 (
-       echo "count=0"
-       echo "breakheight=510"
-       while read version friends announce total days date
+       count=0
+       lastday=0
+        breakheight=510
+       while read version legend
        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"
+                       count=$((count+1))
+                       lastday=$(($lastday-5))
+                       endy=$((breakheight+50+count*50))
+                       if ((endy>lasttotal))
+                       then
+                           # Label over curve hanging right, arrow down
+                           arrowhead=$((lasttotal+50))
+                           echo "set label '$legend' at $lastday-10, $endy+15"
+                       else
+                           # Label under curve hanging left, arrow up
+                           arrowhead=$((lasttotal-5))
+                           strlen=`python -c "print len('$legend')"`
+                           lablen=$((strlen*22))
+                           echo "set label '$legend' at $lastday-$lablen+10, $endy-15"
+                       fi
                        echo set arrow \
-                               from lastday, breakheight \
-                               to lastday, lasttotal+50 \
+                               from $lastday, $endy \
+                               to $lastday, $arrowhead \
                                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
+                       set -- $legend
+                       size=$1 
+                       friends=$2
+                       announce=$3
+                       total=$4
+                       days=$5 
+                       date=$6
                        lastday=$days
                        lasttotal=$total
                fi
@@ -49,26 +76,33 @@ EOF
 
 # OK, now write the major-release labels
 (
-       while read version friends announce total days date
+       while read version size friends announce total days date
        do
-           echo "set arrow from $days, $total - 80 to $days, $total - 30 head"
-           echo "set label '$version' at $days - 5, $total - 90"
+           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 5:4 \
-               title "Both lists" with points 3, \
-     '/tmp/growthannounce$$' using 5:3 \
-               title "fetchmail-announce" with points 4, \
-     '/tmp/growthannounce$$' using 5:2 \
-               title "fetchmail-friends" with points 2
+plot [] [0:] '/tmp/growthnumbers$$' using 6:5 \
+               title "Both lists" with points $blue_boxes, \
+     '/tmp/growthannounce$$' using 6:4 \
+               title "fetchmail-announce" with points $cyan_diamonds, \
+     '/tmp/growthannounce$$' using 6:3 \
+               title "fetchmail-friends" with points $green_crosses, \
+     '/tmp/growthnumbers$$' using 6:2 axes x1y2 \
+               title "Lines of code" with points $brown_triangles
 EOF
 
-# The gnuplot driver for PNG doesn't do color
-gnuplot /tmp/growthimage$$ >growth.gif
-gif2png -s -d -qq growth.gif
+gnuplot /tmp/growthimage$$ >growth.png
 
 rm -f /tmp/growth*
 
 # growthplot ends here
+
+
+
+
+
+
+