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


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

Re: For loop not working as I expected - but now solved

Path csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Chris Elvidge <chris@mshome.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: For loop not working as I expected - but now solved
Date Mon, 19 Feb 2018 12:50:45 +0000
Organization A noiseless patient Spider
Lines 45
Message-ID <p6eh76$i4j$1@dont-email.me> (permalink)
References <p69m96$82n$1@dont-email.me> <p6dti7$cpk$1@solani.org>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Mon, 19 Feb 2018 12:50:46 -0000 (UTC)
Injection-Info reader02.eternal-september.org; posting-host="1135b11d7485f79554972be89a60050e"; logging-data="18579"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19GmQS56nBu+j5qZT+9nIwn8lMxVW3glS4="
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
In-Reply-To <p6dti7$cpk$1@solani.org>
Content-Language en-GB
Cancel-Lock sha1:yH9RzNRBXRrXo4fKXr8OiYXoQK0=
Xref csiph.com comp.graphics.apps.gnuplot:3875

Show key headers only | View raw


On 19/02/2018 07:15 am, Karl Ratzsch wrote:
> Am 17.02.2018 um 17:46 schrieb Chris Elvidge:
> 
>> plot [j=1:7] F(8-j) u 1:4 w l lw 2 lc rgb "orange" t "CPU", '' u 1:5 w l
>> lw 2 lc rgb "green" t "GPU"
> 
> The second part of
> 
>     plot [i=1:4] fname(i) us 1:2, '' us 1:2
> 
> cannot work. '' just contains the last file name, in verbatim, that was
> in the plot command. It doesn't expect a function, and especially cannot
> contain the whole iteration. The error message could be a bit clearer,
> but obviously nobody thought of the specific misuse you tried. ;-)
> 
> You have to repeat the iteration :
> 
>   plot [i=1:4] fname(i) us 1:2 w lc i, for [i=1:4] fname(i) us 1:2 w lc i
> 
> 
> Best, Karl
> 

Sorry Karl, that didn't work either. But thanks for pointing out the 
need for the second "for [i=1:4]" bit.

However, this did work:

F(n) = system("date -d\"-".n." days\" 
\"+/var/tmp/cpu-gpu-temp_%Y%m%d.dat\"")
plot for [j=1:7] F(8-j) u 1:4 w l lw 2 lc rgb "orange" noti, for [j=1:7] 
F(8-j) u 1:5 w l lw 2 lc rgb "web-green" noti

Note the extra "for" after the plot command. Could this be a bug in the 
manual?

Strangely, with "plot for" and '' as the second file specifier, I get 
all the files for the first plot, but only the last file for the second 
plot.

Cheers

-- 

Chris Elvidge, England

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


Thread

For loop not working as I expected Chris Elvidge <chris@mshome.net> - 2018-02-17 16:46 +0000
  Re: For loop not working as I expected Karl Ratzsch <mail.kfr@gmx.net> - 2018-02-19 08:15 +0100
    Re: For loop not working as I expected - but now solved Chris Elvidge <chris@mshome.net> - 2018-02-19 12:50 +0000
      Re: For loop not working as I expected - but now solved Karl Ratzsch <mail.kfr@gmx.net> - 2018-02-19 14:26 +0100
        Re: For loop not working as I expected - but now solved Chris Elvidge <chris@mshome.net> - 2018-02-19 14:22 +0000
          Re: For loop not working as I expected - but now solved Karl Ratzsch <mail.kfr@gmx.net> - 2018-02-19 16:11 +0100
            Re: For loop not working as I expected - but now solved Chris Elvidge <chris@mshome.net> - 2018-02-19 15:25 +0000
        Re: For loop not working as I expected - but now solved Ethan A Merritt <EAMerritt@gmail.com> - 2018-02-21 22:38 -0800
          Re: For loop not working as I expected - but now solved Karl Ratzsch <mail.kfr@gmx.net> - 2018-02-23 18:50 +0100

csiph-web