Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2603 > unrolled thread

Iteration Over Multiple Columns from STDIN

Started byjb_duffy@btinternet.com
First post2014-09-28 07:32 -0700
Last post2014-09-28 21:58 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Iteration Over Multiple Columns from STDIN jb_duffy@btinternet.com - 2014-09-28 07:32 -0700
    Re: Iteration Over Multiple Columns from STDIN Karl <mail.kfr@gmx.net> - 2014-09-28 18:42 +0200
    Re: Iteration Over Multiple Columns from STDIN jb_duffy@btinternet.com - 2014-09-28 09:52 -0700
    Re: Iteration Over Multiple Columns from STDIN Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2014-09-28 21:58 +0200

#2603 — Iteration Over Multiple Columns from STDIN

Fromjb_duffy@btinternet.com
Date2014-09-28 07:32 -0700
SubjectIteration Over Multiple Columns from STDIN
Message-ID<05fdac0a-f528-4842-8e73-8e2ef48fa402@googlegroups.com>
Hi

(Gnuplot 4.6.6 Windows 64)

I'm trying to create 2 plots at the same time from 2 columns of data from stdin (ultimately via a pipe) but I can't seem to get iteration to work.  

I'm happy plotting single column from stdin...

gnuplot> plot '-' using 0:1 with lines, '-' using 0:1 with lines
input data ('e' ends) > 1
input data ('e' ends) > 2
input data ('e' ends) > 3
input data ('e' ends) > e
input data ('e' ends) > 3
input data ('e' ends) > 4
input data ('e' ends) > 5
input data ('e' ends) > e

But, I can't seem to make iteration work for 2 columns of data...

gnuplot> plot for [i=1:2] '-' using 0:i with lines  
input data ('e' ends) > 1 3
input data ('e' ends) > 2 4
input data ('e' ends) > 3 5
input data ('e' ends) > e
input data ('e' ends) > e
         warning: Skipping data file with no valid points

Any suggestions/help would be much appreciated.

Kind regards

John

[toc] | [next] | [standalone]


#2604

FromKarl <mail.kfr@gmx.net>
Date2014-09-28 18:42 +0200
Message-ID<m09djq$hjk$1@news.rz.uni-karlsruhe.de>
In reply to#2603
Am 28.09.2014 16:32, schrieb jb_duffy@btinternet.com:
> But, I can't seem to make iteration work for 2 columns of data...
> 
> gnuplot> plot for [i=1:2] '-' using 0:i with lines  

Hi, that can´t work. gp plots the individual parts (lines) sequentially,
so by the time you get to i=2, the inline dataset is already gone. If
you can use a temporary file, you could try this (not tested now) :

set table ".tempf";plot "-" using 1:2 with table; unset table;\ plot for
[i=1:2] ".tempf" using 0:i; system "del .tempf"


if you can switch to gp5.0 (rc2), you don´t even need the temporary
file, because you can use a new form of inline data:

set table $temp; plot "-" using 1:2 with table; unset table;\ plot for
[i=1:2] $temp" using 0:i


  Karl

[toc] | [prev] | [next] | [standalone]


#2605

Fromjb_duffy@btinternet.com
Date2014-09-28 09:52 -0700
Message-ID<21ea81c1-1db6-4462-ab70-649c6a07224c@googlegroups.com>
In reply to#2603
OK Karl

Thank for getting back to me. I now understand why it can't be done. I will have a look at the new table inline data format in GP 5.0.

Many thanks

John

On Sunday, 28 September 2014 15:32:47 UTC+1, jb_d...@btinternet.com  wrote:
> Hi
> 
> 
> 
> (Gnuplot 4.6.6 Windows 64)
> 
> 
> 
> I'm trying to create 2 plots at the same time from 2 columns of data from stdin (ultimately via a pipe) but I can't seem to get iteration to work.  
> 
> 
> 
> I'm happy plotting single column from stdin...
> 
> 
> 
> gnuplot> plot '-' using 0:1 with lines, '-' using 0:1 with lines
> 
> input data ('e' ends) > 1
> 
> input data ('e' ends) > 2
> 
> input data ('e' ends) > 3
> 
> input data ('e' ends) > e
> 
> input data ('e' ends) > 3
> 
> input data ('e' ends) > 4
> 
> input data ('e' ends) > 5
> 
> input data ('e' ends) > e
> 
> 
> 
> But, I can't seem to make iteration work for 2 columns of data...
> 
> 
> 
> gnuplot> plot for [i=1:2] '-' using 0:i with lines  
> 
> input data ('e' ends) > 1 3
> 
> input data ('e' ends) > 2 4
> 
> input data ('e' ends) > 3 5
> 
> input data ('e' ends) > e
> 
> input data ('e' ends) > e
> 
>          warning: Skipping data file with no valid points
> 
> 
> 
> Any suggestions/help would be much appreciated.
> 
> 
> 
> Kind regards
> 
> 
> 
> John

[toc] | [prev] | [next] | [standalone]


#2606

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2014-09-28 21:58 +0200
Message-ID<c8r7h4FocflU1@mid.dfncis.de>
In reply to#2603
Am 28.09.2014 um 16:32 schrieb jb_duffy@btinternet.com:
> But, I can't seem to make iteration work for 2 columns of data...

You need this to be:

> gnuplot> plot for [i=1:2] '-' using 0:1 with lines
> input data ('e' ends) > 1
> input data ('e' ends) > 2
> input data ('e' ends) > 3
> input data ('e' ends) > e
> input data ('e' ends) > 3
> input data ('e' ends) > 4
> input data ('e' ends) > 5
> input data ('e' ends) > e

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web