From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/92261 Path: news.gmane.org!not-for-mail From: John Kitzmiller Newsgroups: gmane.comp.tex.context Subject: Re: m-graph read data and plot Date: Fri, 7 Aug 2015 13:00:47 -0400 Message-ID: <55B2D0D9-669C-4C39-9DE3-96FC34B102AD@inradius.net> References: <20150807122343.0c4d2fba@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="===============1876703579==" X-Trace: ger.gmane.org 1438966935 20176 80.91.229.3 (7 Aug 2015 17:02:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Aug 2015 17:02:15 +0000 (UTC) Cc: "ntg-context@ntg.nl ConTeXt users" To: Alan BRASLAU Original-X-From: ntg-context-bounces@ntg.nl Fri Aug 07 19:02:00 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 1ZNl1r-0002FM-A8 for gctc-ntg-context-518@m.gmane.org; Fri, 07 Aug 2015 19:01:59 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4A7EF10226 for ; Fri, 7 Aug 2015 19:01:58 +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 S3pAXiGaF7-w for ; Fri, 7 Aug 2015 19:01:52 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 821A810202 for ; Fri, 7 Aug 2015 19:01:14 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 56D70101FD for ; Fri, 7 Aug 2015 19:01:10 +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 9-xBGcceug14 for ; Fri, 7 Aug 2015 19:01:09 +0200 (CEST) Original-Received: from filter3-utr.mf.surf.net (filter3-utr.mf.surf.net [195.169.124.154]) by balder.ntg.nl (Postfix) with ESMTP id EECBE101E6 for ; Fri, 7 Aug 2015 19:01:08 +0200 (CEST) Original-Received: from bosmailout03.eigbox.net (bosmailout03.eigbox.net [66.96.186.3]) by filter3-utr.mf.surf.net (8.14.4/8.14.4/Debian-4) with ESMTP id t77H16RA022637 for ; Fri, 7 Aug 2015 19:01:07 +0200 Original-Received: from bosmailscan04.eigbox.net ([10.20.15.4]) by bosmailout03.eigbox.net with esmtp (Exim) id 1ZNl10-00085h-G7 for ntg-context@ntg.nl; Fri, 07 Aug 2015 13:01:06 -0400 Original-Received: from [10.115.3.31] (helo=bosimpout11) by bosmailscan04.eigbox.net with esmtp (Exim) id 1ZNl10-00009Z-7k for ntg-context@ntg.nl; Fri, 07 Aug 2015 13:01:06 -0400 Original-Received: from bosauthsmtp16.yourhostingaccount.com ([10.20.18.16]) by bosimpout11 with id 1t121r00F0LoEWa01t15rs; Fri, 07 Aug 2015 13:01:06 -0400 X-Authority-Analysis: v=2.1 cv=Q9Rc4uGa c=1 sm=1 tr=0 a=2OW49aEHms2tn/AeNJ+rfA==: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=mWHvHZenAAAA:8 a=8pif782wAAAA:8 a=ryOcBv146zAvBkVgR3gA:9 a=QEXdDO2ut3YA:10 a=K26F9RIodNaK96zIXtkA:9 a=yDqpufp1Fem4Dzhx:21 a=_W_S_7VecoQA:10 Original-Received: from c-75-69-101-28.hsd1.nh.comcast.net ([75.69.101.28]:61191 helo=[10.0.0.4]) by bosauthsmtp16.eigbox.net with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim) id 1ZNl0v-00011U-Rd; Fri, 07 Aug 2015 13:01:01 -0400 In-Reply-To: <20150807122343.0c4d2fba@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.3; 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: 08P1R17rq - ed1d77207caa - 20150807 (trained as not-spam) Received-SPF: pass (filter3-utr.mf.surf.net: domain of SRS0=qYqlTl=IO=inradius.net=kitz@eigbox.net designates 66.96.186.3 as permitted sender) receiver=filter3-utr.mf.surf.net; client-ip=66.96.186.3; envelope-from=; helo=bosmailout03.eigbox.net; identity=mailfrom X-Scanned-By: CanIt (www . roaringpenguin . com) on 195.169.124.154 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:92261 Archived-At: --===============1876703579== Content-Type: multipart/alternative; boundary="Apple-Mail=_04CE9181-AA93-4229-8C67-BF39637AC5C3" --Apple-Mail=_04CE9181-AA93-4229-8C67-BF39637AC5C3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 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=E2=80=99s Figure 9 from the mpgraph manual to work = using m-graph? http://ctan.org/tex-archive/systems/doc/metapost/source-manual = Thanks again, John On Aug 7, 2015, at 6:23 AM, Alan BRASLAU wrote: >=20 > You have two problems: >=20 > 1) gdraw (4,1)--(7,1); > has a unique ordinate, so graph will fail in this case if you do not > explicitly set the range. >=20 > 2) You have to take care with your choice of loop variables in MP not > to run into conflicts those eventually used in macros. Also, as Hans > indicated, you do need to declare that a is an array, as in > numeric a[]; >=20 > Here is a MWE >=20 > \enabletrackers[metapost.showlog] > \usemodule[graph] > \startMPpage[instance=3Dgraph,offset=3D3mm] > draw begingraph(5cm,5cm); > numeric a[]; > gdata("data.d", v, =20 > for j=3D1 upto 3: > a[j]:=3Dscantokens v[j]; > endfor ; > ); >=20 > setrange (whatever,0,whatever,2); > gdraw (a2,a1)--(a3,a1); > endgraph; > \stopMPpage >=20 >=20 > Alan >=20 >=20 > On Thu, 6 Aug 2015 16:48:51 -0400 > John Kitzmiller > wrote: >=20 >> On Aug 6, 2015, at 12:59 PM, Hans Hagen >> >> wrote: >>>=20 >>> On 8/6/2015 5:30 PM, John Kitzmiller wrote: >>>> Given a file, data.d, containing 1 4 7 >>>>=20 >>>> I expected the following code to draw a line from (4,1) to (7,1)=E2=80= =A6 >>>>=20 >>>>=20 >>>> \enabletrackers[metapost.showlog] >>>> \usemodule[m-graph] >>>> \startMPpage[instance=3Dgraph,offset=3D3mm] >>>> draw begingraph(5cm,5cm); >>>> gdata("data.d", v, >>>> for n =3D 1 upto 3: >>>> a[n] =3D scantokens v[n]; >>>> endfor; >>>>=20 >>>> show a1; show a2; show a3; % numeric >>>> show v1; show v2; show v3; % string >>>> gdraw (a2,a1)=E2=80=94(a3,a1); % same problem in or out of = data group >>>> ); >>>> endgraph; >>>> \stopMPpage >>>>=20 >>>> =E2=80=A6the show lines return what I expected, but then come the >>>> complaints: >>>>=20 >>>> ! Inconsistent equation (off by 0.90000000000000002)=E2=80=A6 >>>>>> (0,0,1,0,0,yypart S) >>>> ! Transform components aren't all known=E2=80=A6 >>>>=20 >>>=20 >>>> a[n] =3D scantokens v[n]; >>>=20 >>> is a defined? >>=20 >> Thank you Hans. Do you mean numeric a[n]? It was not explicitly >> declared; I did not think it needed to be=E2=80=94the show commands = write >> what I expect to the log=E2=80=94anyway, declaring a did not help. >>=20 >>>=20 >>> also, use >>>=20 >>> a[n] :=3D scantokens v[n] ; >>=20 >> Done. Still the same error messages and no pdf. >>=20 >>>=20 >>>=20 >>>=20 >>>> My goal is to draw multiple box plots >>>> https://en.wikipedia.org/wiki/Box_plot = >>>> >, either vertical or >>>> horizontal, from data sets, but I am stuck at this early stage. >>=20 >=20 --Apple-Mail=_04CE9181-AA93-4229-8C67-BF39637AC5C3 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
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=E2=80=99s Figure 9 from = the mpgraph manual to work using m-graph?




On Aug 7, 2015, at = 6:23 AM, Alan BRASLAU <alan.braslau@cea.fr> wrote:

You have two problems:

1) gdraw (4,1)--(7,1);
has a unique ordinate, so graph will fail in = this case if you do not
explicitly set the = range.

2) You have to take care = with your choice of loop variables in MP not
to run into conflicts those eventually used in = macros. Also, as Hans
indicated, you do need to = declare that a is an array, as in
numeric a[];

Here is a MWE

\enabletrackers[metapost.showlog]
\usemodule[graph]
\startMPpage[instance=3Dgraph,offset=3D3mm]=
 draw begingraph(5cm,5cm);
   numeric a[];
   gdata("data.d", v, =    
     for j=3D1 upto 3:
       a[j]:=3Dscantokens = v[j];
     endfor ;
     );

   setrange = (whatever,0,whatever,2);
   gdraw = (a2,a1)--(a3,a1);
 endgraph;
\stopMPpage


Alan


On Thu, 6 Aug 2015 = 16:48:51 -0400
John Kitzmiller = <kitz@inradius.net> wrote:

On Aug 6, 2015, at = 12:59 PM, Hans Hagen <pragma@wxs.nl
<mailto:pragma@wxs.nl>> = wrote:

On 8/6/2015 5:30 PM, John Kitzmiller wrote:
Given a file, data.d, = containing 1 4 7

I expected the following = code to draw a line from (4,1) to (7,1)=E2=80=A6


\enabletrackers[metapost.showlog]
\usemodule[m-graph]
\startMPpage[instance=3Dgraph,offset=3D3mm]
 draw begingraph(5cm,5cm);
   gdata("data.d", v,
     for n =3D 1 upto 3:
a[n] =3D scantokens v[n];
     endfor;

     show a1; show a2; show a3; % = numeric
     show v1; show v2; = show v3; % string
     gdraw = (a2,a1)=E2=80=94(a3,a1); % same problem in or out of data group
     );
 endgraph;
\stopMPpage

=E2=80=A6the show lines return what I expected, but then come = the
complaints:

! = Inconsistent equation (off by 0.90000000000000002)=E2=80=A6
(0,0,1,0,0,yypart S)
! = Transform components aren't all known=E2=80=A6


a[n] =3D scantokens v[n];

is a defined?

Thank = you Hans. Do you mean numeric a[n]? It was not explicitly
declared; I did not think it needed to be=E2=80=94the show = commands write
what I expect to the log=E2=80=94anyway, = declaring a did not help.


also, use

a[n] :=3D scantokens v[n] ;

Done. Still the same error messages and no pdf.




My goal is to draw multiple box plots
https://en.wikipedia.org/wiki/Box_plot
<https://en.wikipedia.org/wiki/Box_plot>, either = vertical or
horizontal, from data sets, but I am stuck at = this early stage.



= --Apple-Mail=_04CE9181-AA93-4229-8C67-BF39637AC5C3-- --===============1876703579== 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= --===============1876703579==--