#!/bin/sh
TITLE="More specific Usenet posts containing the word Wikipedia"
YLABEL="Posts per month"
FILE=`echo "$TITLE" | sed 's/\ /_/g'`.png
#--
TMP="_gpdata_$$"
trap "/bin/rm -f ${TMP} ; exit" 0
sed 's/^[ ]*//
s/,/ /g
s/Jan /January /
s/Feb /February /
s/Mar /March /
s/Apr /April /
s/Jun /June /
s/Jul /July /
s/Aug /August /
s/Sep /September /
s/Oct /October /
s/Nov /November /
s/Dec /December /
s/[ ][ ]*/ /g
/^[ ]*$/d' ${1:-usenet2.dat} > ${TMP}
gnuplot <<_EOF_ || exit 1
# Month .org .com total
#January 2001 0 0 0
set xtics ( "J\n2001" 0, "F" 1, "M" 2, "A" 3, "M" 4, "J" 5, "J" 6, "A" 7, "S" 8, "O" 9, "N" 10, "D" 11, \
"J\n2002" 12, "F" 13, "M" 14, "A" 15, "M" 16, "J" 17, "J" 18, "A" 19, "S" 20, "O" 21, "N" 22, "D" 23, \
"J\n2003" 24, "F" 25, "M" 26, "A" 27, "M" 28, "J" 29, "J" 30, "A" 31, "S" 32, "O" 33, "N" 34, "D" 35, \
"J\n2004" 36, "F" 37, "M" 38, "A" 39, "M" 40, "J" 41, "J" 42, "A" 43, "S" 44)
set nox2tics
set size .75,.67
set title "${TITLE}"
set xlabel " "
set ylabel "${YLABEL}"
set grid ytics noxtics
set logscale y
set key left
set terminal png color small
set output '${FILE}'
plot '${TMP}' using 3 title '.org' with lines 1 \
, '' using 4 title '.com' with lines 3 \
, '' using 5 title 'total' with lines 4 \
_EOF_