input graph; prologues := 3; outputformat := "svg"; outputtemplate := "VIZ-12-004.svg"; color Blue, Teal, Orange, Wash, Missing; Blue := (0, 84 / 255, 159 / 255); Teal := (0, 177 / 255, 183 / 255); Orange := (246 / 255, 168 / 255, 0); Wash := (232 / 255, 241 / 255, 250 / 255); Missing := (236 / 255, 236 / 255, 237 / 255); vardef P(expr x, y) = (55 + 345 * (x - (0)) / (75), 45 + 175 * (y - (0)) / (200)) enddef; def rect(expr x, y, xx, yy, col) = fill P(x, y)--P(xx, y)--P(xx, yy)--P(x, yy)--cycle withcolor col; enddef; beginfig(1); fill unitsquare xscaled 420 yscaled 280 withcolor white; label.llft("VIZ-12-004" infont "cmr8", (414, 272)); label.rt(btex Known ages; common bins and common count scale etex scaled .65, (55, 246)); % BEGIN EXAMPLE numeric n, v[][]; n := 0; gdata("data/ages.tsv", c, n := n + 1; for j = 1 upto 10: v[n][j] := scantokens c[j]; endfor ); picture panel; for m = 0 upto 3: panel := nullpicture; addto panel doublepath (0, 65)--(0, 0)--(150, 0) withcolor .4white; for t = 0 step 25 until 75: addto panel also thelabel.bot(decimal t infont "cmr7", (2t, 0)); endfor for t = 0 step 100 until 200: addto panel also thelabel.lft(decimal t infont "cmr7", (0, 65t / 200)); endfor addto panel also thelabel(btex Age (years) etex scaled .7, (75, -20)); for k = 1 upto n: addto panel contour (2v[k][2], 0)--(2v[k][3], 0)--(2v[k][3], 65v[k][7 + m] / 200)--(2v[k][2], 65v[k][7 + m] / 200)--cycle withcolor Blue; endfor if m = 0: addto panel also thelabel(btex 1st etex scaled .8, (75, 76)); fi if m = 1: addto panel also thelabel(btex 2nd etex scaled .8, (75, 76)); fi if m = 2: addto panel also thelabel(btex 3rd etex scaled .8, (75, 76)); fi if m = 3: addto panel also thelabel(btex Crew etex scaled .8, (75, 76)); fi draw panel shifted (55 + 195 * (m mod 2), 155 - 107 * floor(m / 2)); endfor % END EXAMPLE setbounds currentpicture to unitsquare xscaled 420 yscaled 280; endfig; end.