% --- start of displayed preamble in the book --- input piechartmp % --- end of displayed preamble in the book --- % graphic converted to gray in book using 'color2gray' defaultfont:="ptmr8r"; warningcheck:=0; beginfig(1) SetupColors((.7,.7),this,this); SetupPercent(this, " %"); Segment(50,"Lions"); Segment(30,"Tigers"); Segment(10,"Hyaena"); Segment(20,"Monkeys"); Segment(20,"Warthogs"); SegmentState(4,this,0.3); SegmentState(5,invisible,this); PieChart(2cm,0.15,60,0,0); Label.auto(0)(name)(outwards,0); Label(3,4,5)(value)(inwards,0) withcolor white; Label(1,2)(percent)(inwards,0) withcolor (1,1,0); Label.lrt(3)("a segment with ",percent) ((0.9,0.8),(0,-2cm)) withcolor .8red; pickup pencircle scaled 2pt; Label.auto(2)("a green label") ((0.9,0.1),(-1cm,7mm)) withcolor .8green; endfig; end;