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


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

Substitution in iterations

Started byMichael <proximum@land.ru>
First post2013-05-15 02:03 +0700
Last post2013-05-15 11:39 +0700
Articles 3 — 2 participants

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


Contents

  Substitution in iterations Michael <proximum@land.ru> - 2013-05-15 02:03 +0700
    Re: Substitution in iterations sfeam <sfeam@users.sourceforge.net> - 2013-05-14 13:57 -0700
      Re: Substitution in iterations Michael <proximum@land.ru> - 2013-05-15 11:39 +0700

#1829 — Substitution in iterations

FromMichael <proximum@land.ru>
Date2013-05-15 02:03 +0700
SubjectSubstitution in iterations
Message-ID<kmu1ij$cq7$1@dont-email.me>
Hi,

I have a data file with many columns.
Here is a template for my graphs:

elements='1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
plot [][] for [i=1:words(elements)] 'tests.dat' using 1:i+1 lt i+2 lw 6 
t word(elements,i) w linesp

I needed to modify some values. If I did it without iterations, I would 
do it this way:

plot [][] 'tests.dat' using 1:($2*2) lt 3 lw 6 t '1' w linesp,\\
'' using 1:($3*2) lt 4 lw 6 t '2' w linesp,\\
..........

But in iterations it doesn't work, for example:
using 1:($(i+1)*2)
gives an error.

How do (and can do) I, for example, multiply values to 2 in iterations?

Thanks.

[toc] | [next] | [standalone]


#1830

Fromsfeam <sfeam@users.sourceforge.net>
Date2013-05-14 13:57 -0700
Message-ID<kmu88o$k42$1@dont-email.me>
In reply to#1829
Michael wrote:

> Hi,
[snip]
> But in iterations it doesn't work, for example:
> using 1:($(i+1)*2)
> gives an error.

$3 is shorthand for column(3)
But $ shorthand only words for integer constants.

So you want   'using 1:(column(i+1)*2))'

	Ethan






> 
> How do (and can do) I, for example, multiply values to 2 in iterations?
> 
> Thanks.

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


#1831

FromMichael <proximum@land.ru>
Date2013-05-15 11:39 +0700
Message-ID<kmv3bf$bih$1@dont-email.me>
In reply to#1830
  $3 is shorthand for column(3)
> But $ shorthand only words for integer constants.
>
> So you want   'using 1:(column(i+1)*2))'
>
> 	Ethan

Thank you.

[toc] | [prev] | [standalone]


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


csiph-web