prologues := 3;
outputformat := "svg";
defaultfont := "cmr10";
defaultscale := 1.1;
color Blue,Teal,Orange,Green,Grey,Light,Wash;
Blue := (0,84/255,159/255); Teal := (0,177/255,183/255);
Orange := (246/255,168/255,0); Green := (87/255,171/255,39/255);
Grey := (100/255,101/255,103/255); Light := (236/255,236/255,237/255);
Wash := (232/255,241/255,250/255);
% Format displayed numbers to hundredths using integer strings.
vardef numlabel(expr value)=
 save n,whole,frac; numeric n,whole,frac;
 n:=round(100abs value); whole:=floor(n/100); frac:=n mod 100;
 (if value<-.005: "-" & fi decimal whole
  if frac>0: & "." & if frac<10: "0" & fi decimal frac fi)
enddef;
pickup pencircle scaled .9;
outputtemplate := "MPT-13-006.svg";
beginfig(1);
fill unitsquare xscaled 320 yscaled 220 withcolor white;
% BEGIN DRAWING
input graph;
numeric n,t[],v[]; path raw,smoothed;
n:=0;
gdata("data/calibration.dat", row,
 n:=n+1; t[n]:=scantokens row1; v[n]:=scantokens row2;
);
raw:=for j=1 upto n: if j>1: -- fi (t[j],v[j]) endfor;
smoothed:=for j=2 upto n-1: if j>2: -- fi
 (t[j],(v[j-1]+v[j]+v[j+1])/3) endfor;
draw begingraph(240,140);
 setrange(0,0,8,6);
 gdraw raw withcolor Grey;
 gdraw smoothed withpen pencircle scaled 1.8 withcolor Blue;
 glabel.bot(btex Time (s) etex,OUT);
 glabel.lft(btex Response (a.u.) etex rotated 90,OUT);
endgraph shifted (55,42);
message "MPT-13-006: rows=" & decimal n & "; centres=" & decimal(n-2);
% END DRAWING
label.lft("MPT-13-006" infont "cmr8",(312,210));
setbounds currentpicture to unitsquare xscaled 320 yscaled 220;
endfig;
end.
