summaryrefslogtreecommitdiff
path: root/usergrps/uktug/baskervi/7_1/0-3-10.mp
blob: 3784d00cff1792b675fb266a34a06aeb97ea8ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
input graph
defaultfont:="ptmr8r";
warningcheck:=0;
beginfig(1)
numeric r,last; path c,w;
r:=5; c:=fullcircle scaled 2r;
last:=0.0;
def wedge (expr lang,value,perc) =
 numeric current,n,half,xoff,yoff;
 picture p;
 n:=perc*3.6;
 current:=last+n;    half:=last+(n/2);
 w:=buildcycle((0,0)--(2r,0) rotated last,
  c, (2r,0)--(0,0) rotated current);
 gfill w withcolor
   (0.8-(perc/100),0.8-(perc/100),0.8-(perc/100));
 gdraw w;
 if perc > 5:
 p = lang infont defaultfont
    scaled defaultscale;
 glabel(image(unfill bbox p; draw p),
  3/4r*dir(half));
 fi;
 last:=current;
enddef;
draw begingraph(3in,3in);
defaultscale:=0.7;
gdata ("langs.dat",c,
  wedge(c1, (scantokens c2),
   (scantokens c3)););
autogrid(,);  frame withcolor white;
endgraph;
endfig;
end;