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


Groups > comp.graphics.apps.gnuplot > #1504

Re: Group by lines

Newsgroups comp.graphics.apps.gnuplot
Date 2012-11-27 05:58 -0800
References <6f7db29b-3de0-465a-89f9-728f8953df1c@googlegroups.com> <k92f0f$dvd$1@news.rz.uni-karlsruhe.de>
Message-ID <aebd0b2d-c83c-418a-b769-8d523a57e5ec@googlegroups.com> (permalink)
Subject Re: Group by lines
From Nasos Abartzis <ampartzisath@gmail.com>

Show all headers | View raw


On Tuesday, November 27, 2012 3:25:35 PM UTC+2, Karl wrote:
> Am 27.11.2012 13:38, schrieb ampartzisath@gmail.com:
> 
> > Hi all 
> 
> > Im new to Gnuplot.
> 
> > I have a simple file with columns of numbers and i want to plot not line by line but to gather some of them add the values and plot it as one line.
> 
> > 
> 
> > Something like this
> 
> > 
> 
> > 4 5 6 7            8 11 13 16
> 
> > 4 6 7 9  --->>  
> 
> > 5 9 9 0            7 14 15 9
> 
> > 2 5 6 9
> 
> > 
> 
> > 
> 
> 
> 
> Bit tricky, but can be done: (example for two columns, plotting the sum
> 
> of four lines as the value for the last of them)
> 
> 
> 
> 
> 
> fname="test.dat"
> 
> i=0; c1=0; c2=0
> 
> 
> 
> plot fname using  \
> 
> 	((i=i+1, c1=c1+$1, i == 4) ? (     c1_=c1, c1=0, c1_) : (NaN)):\
> 
>         ((       c2=c2+$2, i == 4) ? (i=0, c2_=c2, c2=0, c2_) : (NaN))
> 
> 
> 
> 
> 
> Best load this from a script file.
> 
> 
> 
> The idea is that an expression like (i=i+1, c=c+i, 15) first executes
> 
> the two assignments, but then only returns 15.
> 
> 
> 
>   Karl

Thanks Karl i look into it..
Can i make another question?
Is there a way to choose what line to plot?like we do with the columns?

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Group by lines ampartzisath@gmail.com - 2012-11-27 04:38 -0800
  Re: Group by lines Karl <mail.kfr@gmx.net> - 2012-11-27 14:23 +0100
    Re: Group by lines Nasos Abartzis <ampartzisath@gmail.com> - 2012-11-27 05:58 -0800
      Re: Group by lines Karl <ratzsch@polymer.uka.de> - 2012-11-28 17:53 +0100

csiph-web