On Fri, 7 Aug 2015 13:00:47 -0400
John Kitzmiller <k...@inradius.net> wrote:

> Thank you Alan. setrange is the key I had not tried and I will be
> more careful with (2).
> 
> This may not be the proper way to ask, but it is related to the
> topic: how to get Hobby’s Figure 9 from the mpgraph manual to work
> using m-graph?
> 
> http://ctan.org/tex-archive/systems/doc/metapost/source-manual
> <http://ctan.org/tex-archive/systems/doc/metapost/source-manual>
> 
> Thanks again,
> John

\usemodule [graph]

\startMPpage [instance=graph]

draw begingraph(3in,2in);
  glabel.lft(btex \vbox{\hbox{Quadrillions}\hbox{of BTU}} etex, OUT);
  path p[];
  numeric t;
  gdata("energy.d", $,
    t:=0; augment.p1($1,0);
    for j=2 upto 5:
    t:=t+scantokens $[j]; augment.p[j]($1,t);
    endfor)
  picture lab[];
  lab2=btex coal etex; lab3=btex crude oil etex;
  lab4=btex natural gas etex; lab5=btex hydroelectric etex;
  for j=5 downto 2:
  gfill p[j]--reverse p[j-1]--cycle withcolor .16j*white;
  glabel.lft(image(unfill bbox lab[j]; draw lab[j]), .7+length p[j]);
  endfor
endgraph;
closefrom "energy.d" ;

\stopMPpage



One needs to think about closing the data file as ConTeXt opens a single
MP instance that is run throughout the entire document AND over its
multiple runs. If the file is left open, a second run will try to read
on from the point where it left off.

THIS IS A SUBTLE POINT THAT SHOULD BE NOTICED BY ALL MPLIB USERS!

Alan
-- 
Alan Braslau
CEA DSM-IRAMIS-SPEC
CNRS UMR 3680
Orme des Merisiers
91191 Gif-sur-Yvette cedex FRANCE
tel: +33 1 69 08 73 15
fax: +33 1 69 08 87 86
mailto:alan.bras...@cea.fr
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to