ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: John Kitzmiller <kitz@inradius.net>
To: Alan BRASLAU <alan.braslau@cea.fr>
Cc: "ntg-context@ntg.nl ConTeXt users" <ntg-context@ntg.nl>
Subject: Re: m-graph read data and plot
Date: Thu, 13 Aug 2015 15:37:50 -0400	[thread overview]
Message-ID: <185709FD-C9D9-47E0-BB48-ACC6E254E7BE@inradius.net> (raw)
In-Reply-To: <20150809143810.090fbe75@iram-hb-003386.extra.cea.fr>


[-- Attachment #1.1: Type: text/plain, Size: 1250 bytes --]

On Aug 9, 2015, at 8:38 AM, Alan BRASLAU <alan.braslau@cea.fr> wrote:
> 
> 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!

Thank you for this insight Alan! Two results immediately helpful are:
1) data can be put at the top of the .tex file
2) autogrids can be rendered and then drawn over

The following may not be the best way, but it works to read data from the top of the .tex file and then plot on the autogrid.

% 1 0.5 2.5
% 2 1 3.5

\usemodule[graph]
\startMPpage[instance=graph,offset=2mm]
  draw begingraph(3cm,5cm);
  numeric a[];
    gdata("read1.tex", v,
      setrange(0,0,3,4);
    );
    closefrom "read1.tex";

    autogrid(,grid.lft) withcolor .7white;

    gdata("read1.tex",v,
    for j = 1 upto 3:
        a[j] := scantokens v[j];
      endfor;
      path b;
      augment.b(a1,a2);
      augment.b(a1,a3);
      setrange(0,0,3,4);
      gdraw b;
    );
    closefrom "read1.tex";
  endgraph;
\stopMPpage



[-- Attachment #1.2: Type: text/html, Size: 6458 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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	other threads:[~2015-08-13 19:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.931.1438880362.2446.ntg-context@ntg.nl>
2015-08-06 20:48 ` John Kitzmiller
2015-08-07 10:23   ` Alan BRASLAU
2015-08-07 17:00     ` John Kitzmiller
2015-08-09 12:38       ` Alan BRASLAU
2015-08-13 19:37         ` John Kitzmiller [this message]
2015-08-13 19:57           ` Hans Hagen
2015-08-13 20:31           ` Hans Hagen
2015-08-14  2:39             ` Alan BRASLAU
2015-08-21 14:46               ` Hans Hagen
2015-08-06 15:30 John Kitzmiller
2015-08-06 16:25 ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=185709FD-C9D9-47E0-BB48-ACC6E254E7BE@inradius.net \
    --to=kitz@inradius.net \
    --cc=alan.braslau@cea.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).