From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/92349 Path: news.gmane.org!not-for-mail From: John Kitzmiller Newsgroups: gmane.comp.tex.context Subject: Re: m-graph read data and plot Date: Thu, 13 Aug 2015 15:37:50 -0400 Message-ID: <185709FD-C9D9-47E0-BB48-ACC6E254E7BE@inradius.net> References: <20150807122343.0c4d2fba@iram-hb-003386.extra.cea.fr> <55B2D0D9-669C-4C39-9DE3-96FC34B102AD@inradius.net> <20150809143810.090fbe75@iram-hb-003386.extra.cea.fr> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Content-Type: multipart/mixed; boundary="===============1294297148==" X-Trace: ger.gmane.org 1439494744 17668 80.91.229.3 (13 Aug 2015 19:39:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Aug 2015 19:39:04 +0000 (UTC) Cc: "ntg-context@ntg.nl ConTeXt users" To: Alan BRASLAU Original-X-From: ntg-context-bounces@ntg.nl Thu Aug 13 21:38:50 2015 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZPyKv-00043T-PW for gctc-ntg-context-518@m.gmane.org; Thu, 13 Aug 2015 21:38:49 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id D5BCD1022B for ; Thu, 13 Aug 2015 21:38:48 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id B9y227vDgdAc for ; Thu, 13 Aug 2015 21:38:47 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 4D8C510233 for ; Thu, 13 Aug 2015 21:38:20 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 8147D101F7 for ; Thu, 13 Aug 2015 21:38:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MyPZm2XSnjMX for ; Thu, 13 Aug 2015 21:38:14 +0200 (CEST) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id 87C25101E6 for ; Thu, 13 Aug 2015 21:38:04 +0200 (CEST) Original-Received: from bosmailout10.eigbox.net (bosmailout10.eigbox.net [66.96.186.10]) by filter2-til.mf.surf.net (8.14.4/8.14.4/Debian-4) with ESMTP id t7DJc2KL030341 for ; Thu, 13 Aug 2015 21:38:03 +0200 Original-Received: from bosmailscan11.eigbox.net ([10.20.15.11]) by bosmailout10.eigbox.net with esmtp (Exim) id 1ZPyKA-0008N1-9V for ntg-context@ntg.nl; Thu, 13 Aug 2015 15:38:02 -0400 Original-Received: from [10.115.3.33] (helo=bosimpout13) by bosmailscan11.eigbox.net with esmtp (Exim) id 1ZPyK9-0004pZ-QO for ntg-context@ntg.nl; Thu, 13 Aug 2015 15:38:01 -0400 Original-Received: from bosauthsmtp14.yourhostingaccount.com ([10.20.18.14]) by bosimpout13 with id 4Kdy1r00A0JCtq201Ke14K; Thu, 13 Aug 2015 15:38:01 -0400 X-Authority-Analysis: v=2.1 cv=TYEYtHgh c=1 sm=1 tr=0 a=AnsiuLKgxXFeB68GILQVjQ==:117 a=FAHL2ERDhGLq6us2mS8+wQ==:17 a=pq4jwCggAAAA:8 a=QPcu4mC3AAAA:8 a=y85PGfU6AAAA:8 a=C_IRinGWAAAA:8 a=esbi5I81GEsA:10 a=uRRa74qj2VoA:10 a=kR5K7Kcwvoaxg6gc2fkA:9 a=CjuIK1q_8ugA:10 a=Gr9ZLuCxiy_7BuM0rNcA:9 a=PJjGH9qI4r_uNuN9:21 a=_W_S_7VecoQA:10 Original-Received: from c-75-69-101-28.hsd1.nh.comcast.net ([75.69.101.28]:49400 helo=[10.0.0.4]) by bosauthsmtp14.eigbox.net with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim) id 1ZPyK5-0006oL-TH; Thu, 13 Aug 2015 15:37:57 -0400 In-Reply-To: <20150809143810.090fbe75@iram-hb-003386.extra.cea.fr> X-Mailer: Apple Mail (2.1993) X-EN-UserInfo: 08df34410b47fe835bedcf202d0c2be6:931c98230c6409dcc37fa7e93b490c27 X-EN-AuthUser: kitz@inradius.net X-EN-OrigIP: 75.69.101.28 X-EN-OrigHost: c-75-69-101-28.hsd1.nh.comcast.net X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=66.96.186.10; country=US; region=Massachusetts; city=Burlington; latitude=42.5048; longitude=-71.1956; http://maps.google.com/maps?q=42.5048,-71.1956&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0TP4jC2jw - 0da5fd3323d7 - 20150813 (trained as not-spam) Received-SPF: pass (filter2-til.mf.surf.net: domain of SRS0=iWAi_w=IU=inradius.net=kitz@eigbox.net designates 66.96.186.10 as permitted sender) receiver=filter2-til.mf.surf.net; client-ip=66.96.186.10; envelope-from=; helo=bosmailout10.eigbox.net; identity=mailfrom X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:92349 Archived-At: --===============1294297148== Content-Type: multipart/alternative; boundary="Apple-Mail=_DD3335F4-3A3E-4D1D-AABF-1D4AD971B557" --Apple-Mail=_DD3335F4-3A3E-4D1D-AABF-1D4AD971B557 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On Aug 9, 2015, at 8:38 AM, Alan BRASLAU wrote: >=20 > 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. >=20 > 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=3Dgraph,offset=3D2mm] 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 =3D 1 upto 3: a[j] :=3D 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 --Apple-Mail=_DD3335F4-3A3E-4D1D-AABF-1D4AD971B557 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii 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=3Dgraph,offset=3D2mm]
  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 =3D 1 upto 3:
      =   a[j] :=3D 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


= --Apple-Mail=_DD3335F4-3A3E-4D1D-AABF-1D4AD971B557-- --===============1294297148== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly90ZXguYWFuaGV0Lm5ldAphcmNoaXZlICA6IGh0dHA6Ly9mb3VuZHJ5LnN1cGVsZWMu ZnIvcHJvamVjdHMvY29udGV4dHJldi8Kd2lraSAgICAgOiBodHRwOi8vY29udGV4dGdhcmRlbi5u ZXQKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX18= --===============1294297148==--