ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: m-graph read data and plot
       [not found] <mailman.931.1438880362.2446.ntg-context@ntg.nl>
@ 2015-08-06 20:48 ` John Kitzmiller
  2015-08-07 10:23   ` Alan BRASLAU
  0 siblings, 1 reply; 11+ messages in thread
From: John Kitzmiller @ 2015-08-06 20:48 UTC (permalink / raw)
  To: ntg-context


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

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)…
>> 
>> 
>> \enabletrackers[metapost.showlog]
>> \usemodule[m-graph]
>> \startMPpage[instance=graph,offset=3mm]
>>   draw begingraph(5cm,5cm);
>>     gdata("data.d", v,
>>       for n = 1 upto 3:
>> a[n] = scantokens v[n];
>>       endfor;
>> 
>>       show a1; show a2; show a3; % numeric
>>       show v1; show v2; show v3; % string
>>       gdraw (a2,a1)—(a3,a1); % same problem in or out of data group
>>       );
>>   endgraph;
>> \stopMPpage
>> 
>> …the show lines return what I expected, but then come the complaints:
>> 
>> ! Inconsistent equation (off by 0.90000000000000002)…
>>>> (0,0,1,0,0,yypart S)
>> ! Transform components aren't all known…
>> 
> 
>> a[n] = 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—the show commands write what I expect to the log—anyway, declaring a did not help.

> 
> also, use
> 
> a[n] := 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.


[-- Attachment #1.2: Type: text/html, Size: 8620 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-06 20:48 ` m-graph read data and plot John Kitzmiller
@ 2015-08-07 10:23   ` Alan BRASLAU
  2015-08-07 17:00     ` John Kitzmiller
  0 siblings, 1 reply; 11+ messages in thread
From: Alan BRASLAU @ 2015-08-07 10:23 UTC (permalink / raw)
  To: John Kitzmiller; +Cc: ntg-context

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=graph,offset=3mm]
  draw begingraph(5cm,5cm);
    numeric a[];
    gdata("data.d", v,    
      for j=1 upto 3:
        a[j]:=scantokens 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)…
> >> 
> >> 
> >> \enabletrackers[metapost.showlog]
> >> \usemodule[m-graph]
> >> \startMPpage[instance=graph,offset=3mm]
> >>   draw begingraph(5cm,5cm);
> >>     gdata("data.d", v,
> >>       for n = 1 upto 3:
> >> a[n] = scantokens v[n];
> >>       endfor;
> >> 
> >>       show a1; show a2; show a3; % numeric
> >>       show v1; show v2; show v3; % string
> >>       gdraw (a2,a1)—(a3,a1); % same problem in or out of data group
> >>       );
> >>   endgraph;
> >> \stopMPpage
> >> 
> >> …the show lines return what I expected, but then come the
> >> complaints:
> >> 
> >> ! Inconsistent equation (off by 0.90000000000000002)…
> >>>> (0,0,1,0,0,yypart S)
> >> ! Transform components aren't all known…
> >> 
> > 
> >> a[n] = 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—the show commands write
> what I expect to the log—anyway, declaring a did not help.
> 
> > 
> > also, use
> > 
> > a[n] := 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.
> 



-- 
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.braslau@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-07 10:23   ` Alan BRASLAU
@ 2015-08-07 17:00     ` John Kitzmiller
  2015-08-09 12:38       ` Alan BRASLAU
  0 siblings, 1 reply; 11+ messages in thread
From: John Kitzmiller @ 2015-08-07 17:00 UTC (permalink / raw)
  To: Alan BRASLAU; +Cc: ntg-context@ntg.nl ConTeXt users


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

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


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=graph,offset=3mm]
>  draw begingraph(5cm,5cm);
>    numeric a[];
>    gdata("data.d", v,    
>      for j=1 upto 3:
>        a[j]:=scantokens 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 <mailto:kitz@inradius.net>> wrote:
> 
>> On Aug 6, 2015, at 12:59 PM, Hans Hagen <pragma@wxs.nl <mailto:pragma@wxs.nl>
>> <mailto: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)…
>>>> 
>>>> 
>>>> \enabletrackers[metapost.showlog]
>>>> \usemodule[m-graph]
>>>> \startMPpage[instance=graph,offset=3mm]
>>>>  draw begingraph(5cm,5cm);
>>>>    gdata("data.d", v,
>>>>      for n = 1 upto 3:
>>>> a[n] = scantokens v[n];
>>>>      endfor;
>>>> 
>>>>      show a1; show a2; show a3; % numeric
>>>>      show v1; show v2; show v3; % string
>>>>      gdraw (a2,a1)—(a3,a1); % same problem in or out of data group
>>>>      );
>>>>  endgraph;
>>>> \stopMPpage
>>>> 
>>>> …the show lines return what I expected, but then come the
>>>> complaints:
>>>> 
>>>> ! Inconsistent equation (off by 0.90000000000000002)…
>>>>>> (0,0,1,0,0,yypart S)
>>>> ! Transform components aren't all known…
>>>> 
>>> 
>>>> a[n] = 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—the show commands write
>> what I expect to the log—anyway, declaring a did not help.
>> 
>>> 
>>> also, use
>>> 
>>> a[n] := 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>
>>>> <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.
>> 
> 


[-- Attachment #1.2: Type: text/html, Size: 28102 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-07 17:00     ` John Kitzmiller
@ 2015-08-09 12:38       ` Alan BRASLAU
  2015-08-13 19:37         ` John Kitzmiller
  0 siblings, 1 reply; 11+ messages in thread
From: Alan BRASLAU @ 2015-08-09 12:38 UTC (permalink / raw)
  To: John Kitzmiller; +Cc: ntg-context@ntg.nl ConTeXt users

On Fri, 7 Aug 2015 13:00:47 -0400
John Kitzmiller <kitz@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.braslau@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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-09 12:38       ` Alan BRASLAU
@ 2015-08-13 19:37         ` John Kitzmiller
  2015-08-13 19:57           ` Hans Hagen
  2015-08-13 20:31           ` Hans Hagen
  0 siblings, 2 replies; 11+ messages in thread
From: John Kitzmiller @ 2015-08-13 19:37 UTC (permalink / raw)
  To: Alan BRASLAU; +Cc: ntg-context@ntg.nl ConTeXt users


[-- 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-13 19:37         ` John Kitzmiller
@ 2015-08-13 19:57           ` Hans Hagen
  2015-08-13 20:31           ` Hans Hagen
  1 sibling, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2015-08-13 19:57 UTC (permalink / raw)
  To: ntg-context

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

one can also start with:

graph_close_file := true ;

which will close files after drawing

> 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
>
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-13 19:37         ` John Kitzmiller
  2015-08-13 19:57           ` Hans Hagen
@ 2015-08-13 20:31           ` Hans Hagen
  2015-08-14  2:39             ` Alan BRASLAU
  1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2015-08-13 20:31 UTC (permalink / raw)
  To: ntg-context

On 8/13/2015 9:37 PM, John Kitzmiller wrote:
> On Aug 9, 2015, at 8:38 AM, Alan BRASLAU <alan.braslau@cea.fr
> <mailto: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

an apetizer:

\usemodule[graph]

\startluacode
     local d = nil
     function MP.set(data)
         d = data
     end
     function MP.n()
         mp.print(d and #d or 0)
     end
     function MP.get(i,j)
         mp.print(d and d[i] and d[i][j] or 0)
     end
\stopluacode

\startluacode
     MP.set {
         { 1, 0.5, 2.5 },
         { 2, 1.0, 3.5 },
     }
\stopluacode

\startMPpage[instance=graph,offset=2mm]
draw begingraph(3cm,5cm);
     numeric a[];
     for j = 1 upto MP.n() :
         path b;
         augment.b(MP.get(j,1),MP.get(j,2));
         augment.b(MP.get(j,1),MP.get(j,3));
         setrange(0,0,3,4);
         gdraw b;
         endfor ;
endgraph ;
\stopMPpage




-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-13 20:31           ` Hans Hagen
@ 2015-08-14  2:39             ` Alan BRASLAU
  2015-08-21 14:46               ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Alan BRASLAU @ 2015-08-14  2:39 UTC (permalink / raw)
  To: Hans Hagen; +Cc: ntg-context

On Thu, 13 Aug 2015 22:31:23 +0200
Hans Hagen <pragma@wxs.nl> wrote:

> an apetizer:
> 
> \usemodule[graph]
> 
> \startluacode

No such juicy appetizers except for those who will be attending the
ConTeXt meeting!

Alan
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-14  2:39             ` Alan BRASLAU
@ 2015-08-21 14:46               ` Hans Hagen
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2015-08-21 14:46 UTC (permalink / raw)
  To: Alan BRASLAU; +Cc: ntg-context

On 8/14/2015 4:39 AM, Alan BRASLAU wrote:
> On Thu, 13 Aug 2015 22:31:23 +0200
> Hans Hagen <pragma@wxs.nl> wrote:
>
>> an apetizer:
>>
>> \usemodule[graph]
>>
>> \startluacode
>
> No such juicy appetizers except for those who will be attending the
> ConTeXt meeting!

ok, a temporary embargo on neat tricks then

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: m-graph read data and plot
  2015-08-06 15:30 John Kitzmiller
@ 2015-08-06 16:25 ` Hans Hagen
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2015-08-06 16:25 UTC (permalink / raw)
  To: ntg-context

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)…
>
>
> \enabletrackers[metapost.showlog]
> \usemodule[m-graph]
> \startMPpage[instance=graph,offset=3mm]
>    draw begingraph(5cm,5cm);
>      gdata("data.d", v,
>        for n = 1 upto 3:
> a[n] = scantokens v[n];
>        endfor;
>
>        show a1; show a2; show a3; % numeric
>        show v1; show v2; show v3; % string
>        gdraw (a2,a1)—(a3,a1); % same problem in or out of data group
>        );
>    endgraph;
> \stopMPpage
>
> …the show lines return what I expected, but then come the complaints:
>
> ! Inconsistent equation (off by 0.90000000000000002)…
>  >> (0,0,1,0,0,yypart S)
> ! Transform components aren't all known…
>

 > a[n] = scantokens v[n];

is a defined?

also, use

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



> 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.
>
>
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

* m-graph read data and plot
@ 2015-08-06 15:30 John Kitzmiller
  2015-08-06 16:25 ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: John Kitzmiller @ 2015-08-06 15:30 UTC (permalink / raw)
  To: ntg-context


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

Given a file, data.d, containing 1 4 7

I expected the following code to draw a line from (4,1) to (7,1)…


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

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

…the show lines return what I expected, but then come the complaints:

! Inconsistent equation (off by 0.90000000000000002)…
>> (0,0,1,0,0,yypart S)
! Transform components aren't all known…


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. 


[-- Attachment #1.2: Type: text/html, Size: 2120 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-08-21 14:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.931.1438880362.2446.ntg-context@ntg.nl>
2015-08-06 20:48 ` m-graph read data and plot 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
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

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).