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-10-003.svg";
beginfig(1);
fill unitsquare xscaled 320 yscaled 220 withcolor white;
% BEGIN DRAWING
numeric xmin,xmax,ymin,ymax,xx,yy;
xmin:=0; xmax:=10; ymin:=0; ymax:=8;
vardef P(expr x,y)=
 (40+250*(x-xmin)/(xmax-xmin),35+145*(y-ymin)/(ymax-ymin))
enddef;
for i=0 upto 4:
 xx:=xmin+i*(xmax-xmin)/4; yy:=ymin+i*(ymax-ymin)/4;
 draw P(xx,ymin)--P(xx,ymax) withcolor Light;
 draw P(xmin,yy)--P(xmax,yy) withcolor Light;
 label.bot(numlabel(xx),P(xx,ymin));
 label.lft(numlabel(yy),P(xmin,yy));
endfor
draw P(xmin,ymax)--P(xmin,ymin)--P(xmax,ymin) withcolor Grey;
numeric v[];
v[1]:=1;
v[2]:=2;
v[3]:=2;
v[4]:=2;
v[5]:=3;
v[6]:=3;
v[7]:=4;
v[8]:=4;
v[9]:=4;
v[10]:=5;
v[11]:=5;
v[12]:=5;
v[13]:=5;
v[14]:=6;
v[15]:=7;
v[16]:=8;
v[17]:=8;
v[18]:=9;
numeric count[],total;
for b=1 upto 5: count[b]:=0; endfor
for i=1 upto 18: b:=floor(v[i]/2)+1; count[b]:=count[b]+1; endfor
total:=0;
for b=1 upto 5:
 total:=total+count[b];
 fill P(2b-2,0)--P(2b,0)--P(2b,count[b])--P(2b-2,count[b])--cycle
  withcolor (b/6)[Blue,Teal];
 label.top(decimal count[b],P(2b-1,count[b]));
endfor
message "check: histogram-total="&decimal total;
% END DRAWING
label.lft("MPT-10-003" infont "cmr8",(312,210));
setbounds currentpicture to unitsquare xscaled 320 yscaled 220;
endfig;
end.
