input graph; prologues := 3; outputformat := "svg"; outputtemplate := "VIZ-09-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.5)) / (4.0), 45 + 175 * (y - (0)) / (75)) 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-09-004" infont "cmr8", (414, 272)); label.rt(btex Gaussian KDE: bandwidth 3 years; common width scale etex scaled .65, (55, 246)); draw P(0.5, 75)--P(0.5, 0)--P(4.5, 0) withcolor .4white; label.bot(btex 1st etex scaled .7, P(1, 0)); label.bot(btex 2nd etex scaled .7, P(2, 0)); label.bot(btex 3rd etex scaled .7, P(3, 0)); label.bot(btex Crew etex scaled .7, P(4, 0)); label.lft(btex 0 etex scaled .7, P(0.5, 0)); label.lft(btex 15 etex scaled .7, P(0.5, 15)); label.lft(btex 30 etex scaled .7, P(0.5, 30)); label.lft(btex 45 etex scaled .7, P(0.5, 45)); label.lft(btex 60 etex scaled .7, P(0.5, 60)); label.lft(btex 75 etex scaled .7, P(0.5, 75)); label(btex Passenger class / crew etex scaled .8, (227.5, 13)); label(btex Age (years) etex scaled .8 rotated 90, (13, 132)); % BEGIN EXAMPLE path curve; gdata("data/violin-1.tsv", c, if i = 1: curve := P(scantokens c1, scantokens c2); else: curve := curve--P(scantokens c1, scantokens c2); fi ); fill curve--cycle withcolor Wash; draw curve--cycle withcolor Blue; gdata("data/violin-2.tsv", c, if i = 1: curve := P(scantokens c1, scantokens c2); else: curve := curve--P(scantokens c1, scantokens c2); fi ); fill curve--cycle withcolor Wash; draw curve--cycle withcolor Blue; gdata("data/violin-3.tsv", c, if i = 1: curve := P(scantokens c1, scantokens c2); else: curve := curve--P(scantokens c1, scantokens c2); fi ); fill curve--cycle withcolor Wash; draw curve--cycle withcolor Blue; gdata("data/violin-4.tsv", c, if i = 1: curve := P(scantokens c1, scantokens c2); else: curve := curve--P(scantokens c1, scantokens c2); fi ); fill curve--cycle withcolor Wash; draw curve--cycle withcolor Blue; % END EXAMPLE setbounds currentpicture to unitsquare xscaled 420 yscaled 280; endfig; end.