diff options
Diffstat (limited to 'tex/context/base/m-graph.tex')
-rw-r--r-- | tex/context/base/m-graph.tex | 191 |
1 files changed, 67 insertions, 124 deletions
diff --git a/tex/context/base/m-graph.tex b/tex/context/base/m-graph.tex index dd30cef46..6f71cca3c 100644 --- a/tex/context/base/m-graph.tex +++ b/tex/context/base/m-graph.tex @@ -11,47 +11,79 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D I finally finished graph support, if only because I could -%D not stand the idea that Karel Wesseling would revert to -%D \PiCTeX. +\loadmarkfile{m-graph} -% pre 2000.08.06 version -% -% \forceMPTEXgraphictrue -% -% \startMPinitializations -% initialize_numbers ; % make sure that pseudo typesetting is set up -% input graph ; % load the graph package -% Autoform := "@g" ; % change the % template char into @ -% \stopMPinitializations +\doifnotmode {demo} {\endinput} + +%D You need to have the data files in your path, +%D otherwise the run is aborted. + +\doiffileelse {agepop91.d} {} {\writestatus{graph}{no data files found}\wait\end} + +%D The test: -%D The latest version does things more automatically (and -%D efficiently when no text processing is needed). For -%D definitions embedded in your document, you need to -%D use \type {@} as template character, in external files, -%D \type {%} is also supported. +\starttext -\startMPinitializations - input graph ; -\stopMPinitializations +\startMPpage +draw begingraph(3in,2in); + gdraw "agepop91.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + gdraw "agepop91.d" plot btex$\bullet$etex; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); + glabel.bot(btex Age in years etex, OUT); + gdraw "agepopm.d"; + endgraph; +\stopMPpage + +\startMPpage +draw begingraph(3in,2in); + glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); + glabel.bot(btex Age in years etex, OUT); + setrange(origin, whatever,whatever); + gdraw "agepopm.d"; + endgraph; +\stopMPpage -%D Graphics that have \type {begingraph} in them are -%D recognized as such and force handling of embedded \TEX\ -%D code. +\startMPpage +draw begingraph(2.3in,2in); + setcoords(log,log); + glabel.lft(btex Seconds etex,OUT); + glabel.bot(btex Matrix size etex, + OUT); + gdraw "matmul.d" dashed evenly; + glabel.ulft(btex Standard etex,8); + gdraw "matmul.d"; + glabel.lrt(btex Strassen etex,7); + endgraph; +\stopMPpage -\forceMPTEXcheck{begingraph} +\startMPpage +draw begingraph(6.5cm,4.5cm); + setrange(80,0, 90,whatever); + glabel.bot(btex Year etex, OUT); + glabel.lft(btex \vbox{\hbox{Emissions in} \hbox{thousands of} + \hbox{metric tons} \hbox{(heavy line)}}etex, OUT); + gdraw "lead.d" withpen pencircle scaled 1.5pt; + autogrid(,otick.lft); + setcoords(linear,linear); + setrange(80,0, 90,whatever); + glabel.rt(btex \vbox{\hbox{Micrograms} \hbox{per cubic} + \hbox{meter of air} \hbox{(thin line)}}etex, OUT); + gdraw "lead.d"; + autogrid(otick.bot,otick.rt); + endgraph; +\stopMPpage -%D If you run into troubles, try: -%D -%D \starttyping -%D \forceMPTEXgraphictrue -%D \stoptyping -%D -%D A demo can be run with: -%D -%D \starttyping -%D texexec --mode=demo --pdf m-graph -%D \stoptyping +\stoptext % No longer needed, since John will fix it. % @@ -141,92 +173,3 @@ % string everybegingraph ; % % everybegingraph := "setrange(0,0,20000,20000)" ; % fi ; - -\startMPinitializations - % @# is X_ or Y_; $ is Gxcvlin_ or Gycvlin_; l and h are numeric or string - % It would not be OK to set (@#low,@#high) to a pair expression because $ might - % try to rescale @#low when evaluating the right-hand side for @#high. - vardef Gsetr_@\#(suffix $)(expr l, h) = - Gclbnds_@\# ; - if @\#ctyp>0 : - @\#low = if abs @\#ctyp<>log: $ fi Mlog_Str l ; - @\#high = if abs @\#ctyp<>log: $ fi Mlog_Str h ; - else : - -@\#high = if abs @\#ctyp<>log: $ fi Mlog_Str l ; - -@\#low = if abs @\#ctyp<>log: $ fi Mlog_Str h ; - fi - enddef ; -\stopMPinitializations - -\doifnotmode {demo} {\endinput} - -%D You need to have the data files in your path, -%D otherwise the run is aborted. - -\doiffileelse {agepop91.d} - {} {\writestatus{graph}{no data files found}\wait\end} - -%D The test: - -\starttext - -\startMPpage -draw begingraph(3in,2in); - gdraw "agepop91.d"; - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(3in,2in); - gdraw "agepop91.d" plot btex$\bullet$etex; - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(3in,2in); - glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); - glabel.bot(btex Age in years etex, OUT); - gdraw "agepopm.d"; - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(3in,2in); - glabel.lft(btex \vbox{\hbox{Population} \hbox{in millions}} etex, OUT); - glabel.bot(btex Age in years etex, OUT); - setrange(origin, whatever,whatever); - gdraw "agepopm.d"; - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(2.3in,2in); - setcoords(log,log); - glabel.lft(btex Seconds etex,OUT); - glabel.bot(btex Matrix size etex, - OUT); - gdraw "matmul.d" dashed evenly; - glabel.ulft(btex Standard etex,8); - gdraw "matmul.d"; - glabel.lrt(btex Strassen etex,7); - endgraph; -\stopMPpage - -\startMPpage -draw begingraph(6.5cm,4.5cm); - setrange(80,0, 90,whatever); - glabel.bot(btex Year etex, OUT); - glabel.lft(btex \vbox{\hbox{Emissions in} \hbox{thousands of} - \hbox{metric tons} \hbox{(heavy line)}}etex, OUT); - gdraw "lead.d" withpen pencircle scaled 1.5pt; - autogrid(,otick.lft); - setcoords(linear,linear); - setrange(80,0, 90,whatever); - glabel.rt(btex \vbox{\hbox{Micrograms} \hbox{per cubic} - \hbox{meter of air} \hbox{(thin line)}}etex, OUT); - gdraw "lead.d"; - autogrid(otick.bot,otick.rt); - endgraph; -\stopMPpage - -\stoptext |