Regarding the metapost graph macros,<br><br>I'm building bargraphs with metapost and have a problem positioning<br>the labels for the bars. I need the y value in the graph space, but the x value in the "outside"
<br>coordinates. I've crawled around the macros, but they are too deep for me!<br><br>Cheers,<br>Geoff Russell.<br><br>------------ Sample data file: totalwater.d<br>1 3 Beef<br>2 5 Dairy<br>3 13 Rice<br>
4 16 Cotton<br><br>-------------- Metapost code<br><br>prologues:=1; warningcheck:=0;<br>input string<br>input sarith<br>input graph<br>numeric barwidth; barwidth:=0.4;<br>color lightc;<br>lightc:=5/6[red,white];<br>
<br>vardef dobar (expr y,w,l) =<br> save p; pair p; p:=(0,Scvnum s1-0.2);<br> gfill p--(p+(w,0))--(p+(w,barwidth))-- <br> (p+(0,barwidth))--cycle withcolor c[1];<br> % I NEED SOMETHING HERE TO POSITION label l
<br>enddef;<br><br>color c[]; <br>c[1]:=blue; c[2]:=lightc; c[3]:=1/2[blue,red];<br><br>% Total Water Use <br>beginfig(1);<br> draw begingraph(2in,1.4in);<br> gdata("totalwater.d",s,<br> dobar (Scvnum s1,Scvnum s2,s3);
<br> ); <br> autogrid(otick.bot,); <br> glabel.top(btex \vbox{\hbox{Total Water Use --- '000 gigalitres}} etex,OUT);<br> endgraph;<br>endfig;<br>end<br><br>