EPS: belmont.eps
Script: make-belmont.tcl
# source the library
source zplot.tcl; namespace import Zplot::*
# define the canvas
PsCanvas -title "belmont.eps" -width 8.5in -height 3.5in
set c(runavg) forestgreen
set c(best) orange
# read in the file into a table called bar1
Table -file "belmont.2.data" -separator ":"
TableAddColumns -columns zero -value 0
TableSort -column year -integer true
# get last value from table, add something to it
set maxyear [TableGetMax -column year]
# this defines one particular drawing area
Drawable -xrange 1925,2010 -yrange 138,156 -coord 40,40
Drawable -drawable d2 -xrange 1925,2010 -yrange 0,1 -coord 40,40
set mean 149.19; set stddev 1.78357
Box -coord 1926,[expr $mean-$stddev]:2007,[expr $mean+$stddev] -linewidth 0 -fill t -fillcolor lightgrey
# make colored backgrounds
for {set y 1925} {$y <= 2010} {incr y 2} {
Box -coord $y,138:[expr $y+1],156 -linewidth 0 -fill t -fillcolor lavender
}
# should calculate this!
Line -coord 1926.5,$mean:2007.5,$mean -linewidth 0.5 -linedash 2,2
# labels
Label -coord 1935.5,[expr $mean-3] -text "Overall Average ($mean +/- [format %.2f $stddev])" -fontsize 7 -anchor l,c
Line -coord 1935,[expr $mean-3]:1930,[expr $mean-0.6] -arrow t -linewidth 0.5
Label -coord 1946.5,154 -text "Running Average" -fontsize 7 -anchor l,c -color $c(runavg)
Line -coord 1946,154:1938,152 -arrow t -linewidth 0.5 -linecolor $c(runavg) -arrowfillcolor $c(runavg) -arrowlinecolor $c(runavg)
Label -coord 2008,149 -text ""
AxesTicsLabels -xtitle "Year" -ytitle "Time (Seconds)" -title "Belmont" -yauto 138,156,2 -xauto 1930,2000,10
PlotLines -xfield year -yfield time -linecolor black -linewidth 0.5 -stairstep true
TableMath -destcol year -expression {$year + 0.5}
PlotLines -drawable d2 -xfield year -yfield zero -labelfield horse -labelrotate 90 -labelsize 6 -labelanchor l,c
PlotLines -xfield year -yfield runavg -linewidth 0.5 -linecolor $c(runavg)
Line -coord 2007,148.74:2008,148.74 -linewidth 0.5
Line -coord 1976.5,144:1975,144 -arrow t -linewidth 0.5 -arrowfillcolor $c(best) -arrowfill $c(best) -linecolor $c(best) -arrowlinecolor $c(best)
Label -coord 1977,144 -text "Why we remember Secretariat" -anchor l,c -color $c(best) -fontsize 7
Label -drawable d2 -coord 1973.5,0 -anchor l,c -rotate 90 -text "Secretariat" -fontsize 6 -color $c(best) -shift 0,3 -bgcolor lavender
PsRender -file "belmont.eps"
Data: belmont.2.data