]> Pileus Git - ~andy/fetchmail/blob - growthplot
Before showdots,
[~andy/fetchmail] / growthplot
1 #!/bin/sh
2 #
3 # growthplot -- plot the fetchmail population's growth as a function of time
4 #
5
6 # Get data from the NEWS file
7 timeseries >/tmp/growthplot$$
8 grep "^[0-9]" /tmp/growthplot$$ >/tmp/growthnumbers$$
9 grep "^[0-9.]*.[05].0   " /tmp/growthplot$$ >/tmp/growthmajors$$
10 sed '/^4.2.9/,$d' </tmp/growthnumbers$$ >/tmp/growthannounce$$
11
12 cat >/tmp/growthimage$$ <<EOF
13 set title "Fetchmail project growth history"
14 set xlabel 'Days since baseline'
15 set ylabel 'Participants'
16 set y2label 'Lines of code'
17 set ytics nomirror
18 set y2tics
19 set tics out
20 set autoscale  y
21 set y2range [5000:50000]
22 set key bottom right box
23 set terminal png color
24
25 EOF
26
27 # OK, now write the event labels
28 (
29         echo "count=0"
30         echo "breakheight=510"
31         while read version size friends announce total days date
32         do
33                 if [ "$version" = '%' ]
34                 then
35                         legend="$size $friends $announce $total $days $date"
36                         echo "# Associate $lastday to '$legend'"
37                         echo "count = count + 1"
38                         echo "lastday = $lastday - 5"
39                         echo "lasttotal = $lasttotal"
40                         echo "endy = breakheight + 50 + count * 50"
41                         echo set arrow \
42                                 from lastday, endy \
43                                 to lastday, lasttotal+50 \
44                                 head
45                         echo "set label '$legend' at lastday-10, endy+15"
46                 else
47                         lastday=$days
48                         lasttotal=$total
49                 fi
50         done
51 ) </tmp/growthplot$$ >>/tmp/growthimage$$ 
52
53 # OK, now write the major-release labels
54 (
55         while read version size friends announce total days date
56         do
57             echo "set arrow from $days, $total - 55 to $days, $total - 15 head"
58             echo "set label '$version' at $days - 5, $total - 65"
59         done
60 ) </tmp/growthmajors$$ >>/tmp/growthimage$$ 
61
62 cat >>/tmp/growthimage$$ <<EOF
63 plot [] [0:] '/tmp/growthnumbers$$' using 6:5 \
64                 title "Both lists" with points 3, \
65      '/tmp/growthannounce$$' using 6:4 \
66                 title "fetchmail-announce" with points 5, \
67      '/tmp/growthannounce$$' using 6:3 \
68                 title "fetchmail-friends" with points 2, \
69      '/tmp/growthnumbers$$' using 6:2 axes x1y2 \
70                 title "Lines of code" with points 7
71 EOF
72
73 gnuplot /tmp/growthimage$$ >growth.png
74
75 rm -f /tmp/growth*
76
77 # growthplot ends here