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-14-001.svg";
input graph;
numeric n,t[],observed[],model[],low[],high[],valid[];
n:=0;
gdata("data/readings.dat", row,
 n:=n+1; t[n]:=scantokens row1; observed[n]:=scantokens row2;
 model[n]:=scantokens row3; low[n]:=scantokens row4;
 high[n]:=scantokens row5; valid[n]:=scantokens row6;
);
beginfig(1);
fill unitsquare xscaled 320 yscaled 220 withcolor white;
% BEGIN DRAWING
vardef panel(expr origin,which)=
 draw (origin+(0,120))--origin--(origin+(112,0)) withcolor Grey;
 for j=1 upto n:
  if (which=2) or (valid[j]=1):
   fill fullcircle scaled 3 shifted
    (origin+(14t[j],20*(if which=1: observed[j] else: model[j] fi)))
    withcolor if which=1: Blue else: Teal fi;
  fi
 endfor;
 label.lft("0",origin); label.lft("6",origin+(0,120));
 label.bot("0",origin); label.bot("8",origin+(112,0));
 label.bot("Time (s)",origin+(56,-13));
enddef;
panel((40,47),1); panel((188,47),2);
label.top("(a) Observed",(96,176));
label.top("(b) Model",(244,176));
label("Response (a.u.); identical axes" infont "cmr8",(165,196));
% END DRAWING
label.lft("MPT-14-001" infont "cmr8",(312,210));
setbounds currentpicture to unitsquare xscaled 320 yscaled 220;
endfig;
end.
