Debian Codegraph @

texmf-dist/doc/metapost/metapost-colorbrewer/colorbrewer-sampler.mp

raw
1 prologues := 3;
2 outputtemplate := "%j.eps";
3
4 input colorbrewer-cmyk
5
6 beginfig(1);
7 defaultfont := "phvr8r";
8 x = 0; y = 0; bx = 8; by = -13; path box; box = unitsquare shifted -(1/2,1/2) xscaled bx yscaled by;
9 forsuffixes gamut =
10 Reds, Oranges, Greens, Blues, Purples, Greys,
11 Skip,
12 OrRd, YlOrRd, YlOrBr, YlGn, BuGn, PuBuGn, YlGnBu, GnBu, PuBu, RdPu, PuRd, BuPu,
13 Skip,
14 PRGn, PiYG, BrBG, PuOr, RdGy, RdBu, RdYlBu, RdYlGn, Spectral,
15 Skip,
16 Accent, DarkTwo, PastelTwo, SetTwo,
17 PastelOne, SetOne, SetThree, Paired:
18
19 for i=3 upto 12:
20 if known gamut[i][1]:
21 label.lft(decimal i & ":", (x,y));
22 if i=3:
23 label.lft(str gamut, (x-15,y));
24 fi
25 fi
26 for j = 1 upto i:
27 if known gamut[i][j]:
28 fill box shifted (x+j*bx, y) withcolor gamut[i][j];
29 fi
30 endfor
31 x := x + i*bx + 32;
32 endfor
33 y := y + by * 17/13;
34 x := 0;
35 endfor
36 label.rt("Single hue, sequential",(560,-42));
37 label.rt("Multi-hue, sequential", (560,-212));
38 label.rt("Assortments", (560,-552));
39 label.rt("Diverging", (780,-402));
40 path b; b = unitsquare shifted -(1/2,1/2) yscaled 55 xscaled 233 shifted (720, -120);
41 fill b withcolor Paired[4][1]; draw b withcolor Paired[4][2];
42 label.top("Colorbrewer for Metapost" infont "phvb8r" scaled 1.414, center b);
43 label.bot("http://colorbrewer2.org", center b shifted 2 down);
44 endfig;
45 end.