Lots of fun with pie charts. Just for the heck of it, here's a
modified version of Ted's pie-chart mechanism that "remembers"
the angles of the wedges and allows you to give the wedge size
as a percentage of the whole "pie" (plus, it allows you to use
"groff" colors; the \N'32' (which should be a space) fools groff
into thinking it's printing something and makes it output the
code to change color, which it otherwise wouldn't do).
.sp 3c
.de YY
ps: def
/wedg
{ gsave currentpoint translate 1 -1 scale
newpath 0 0 moveto 0 0 5 2 roll 3.6 mul exch
3.6 mul dup 3 1 roll add arc closepath
gsave fill grestore 0 setgray stroke
grestore }
def
..
.ds wedg \m[\\$2]\Z'\N'32''\
\X'ps: exec \\n[pieradius] \\n[pieangle] \\$1 wedg'\
\R'pieangle +\\$1'\m[]
\Y[YY]\c
.eo
.de pie
This is a line with \D'l 5p 0'\h'\n[pieradius]p'\h'1p'\
\*[wedg 10 red]\
\*[wedg 20 green]\
\*[wedg 30 blue]\
\*[wedg 2 purple]\
\*[wedg 38 yellow]\
\h'1p'\h'\n[pieradius]p'\D'l 5p 0' in the middle of it.
..
.ec
.nr pieangle 0
.nr pieradius 35
.pie
.nr pieradius 10
.nr pieangle 20 \" 20% is 72 degrees
.pie
_______________________________________________
Groff mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/groff