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-004.svg";
beginfig(1);
fill unitsquare xscaled 320 yscaled 220 withcolor white;
% BEGIN DRAWING
numeric v[];
v[1]:=8;
v[2]:=2;
v[3]:=5;
v[4]:=11;
v[5]:=3;
v[6]:=7;
v[7]:=9;
v[8]:=4;
v[9]:=8;
v[10]:=6;
v[11]:=3;
v[12]:=5;
numeric N,temp,qone,median,qthree;
N:=12;
for pass=1 upto N-1:
 for i=1 upto N-pass:
  if v[i]>v[i+1]:
   temp:=v[i]; v[i]:=v[i+1]; v[i+1]:=temp;
  fi
 endfor
endfor
qone:=(v[3]+v[4])/2; median:=(v[6]+v[7])/2; qthree:=(v[9]+v[10])/2;
vardef X(expr x)=40+20x enddef;
draw (X(0),50)--(X(12),50) withcolor Grey;
for x=0 step 3 until 12: label.bot(decimal x,(X(x),47)); endfor
draw (X(v[1]),110)--(X(v[N]),110) withcolor Blue;
fill (X(qone),85)--(X(qthree),85)--(X(qthree),135)--(X(qone),135)--cycle withcolor Wash;
draw (X(qone),85)--(X(qthree),85)--(X(qthree),135)--(X(qone),135)--cycle withcolor Blue;
draw (X(median),85)--(X(median),135) withpen pencircle scaled 2 withcolor Orange;
draw (X(v[1]),100)--(X(v[1]),120) withcolor Blue;
draw (X(v[N]),100)--(X(v[N]),120) withcolor Blue;
for i=1 upto N: fill fullcircle scaled 3 shifted (X(v[i]),165+3*(i mod 2)) withcolor Teal; endfor
message "check: quartiles="&decimal qone&","&decimal median&","&decimal qthree;
% END DRAWING
label.lft("MPT-10-004" infont "cmr8",(312,210));
setbounds currentpicture to unitsquare xscaled 320 yscaled 220;
endfig;
end.
