Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2558
| From | Ethan A Merritt <EAMerritt@gmail.com> |
|---|---|
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: difficult for loop synax :-| |
| Date | 2014-08-20 17:50 -0700 |
| Organization | made entirely of Lego |
| Message-ID | <lt3fpe$550$1@dont-email.me> (permalink) |
| References | <9bc28e9e-f776-4407-8acc-f0bc7a964bcf@googlegroups.com> <lt0s51$jbh$1@dont-email.me> <7d92eab8-bceb-49bb-80aa-ff7834bc9a73@googlegroups.com> <lt2l49$hgn$1@dont-email.me> <9066cc28-d4c2-4bb6-a081-4ce966222a7e@googlegroups.com> |
Kalin Kozhuharov wrote:
> Hello Ethan,
>
> Thank you for your time! I was trying to make self-contained example,
> but because it was simple enough you "optimized" it ;-) "Premature
> optimization is the root of all evil", said D. Knuth :-D
>
> On Thursday, August 21, 2014 2:15:51 AM UTC+9, Ethan A Merritt wrote:
>>> Well, may be I oversimplified it, but the real thing is too complex
>>> anyway. What about this:
>>>
>>> reset; f1(x) = (C=1.134324*x,0); f2(x) = sin(C*x); set xrange
>>> [0:3.14]; plot a=f1(1), f2(x) title "n=1", a=f1(2), f2(x) title
>>> "n=2" , a=f1(3), f2(x) title "n=3";
>>
>> It is still not clear what you are aiming for.
>> The sequence of commands above does not make sense.
>>
>> The function f1(x) is never plotted, so it plays no role except for
>> its side effect of setting C to a constant.
>>
> Well, yes I'd have to admit I am using side-effects here.
> And my code is turning to a small mess because I am trying to have
> gnuplot do statistics in-line, instead of preprocessing the data.
>
> My current code is here:
> https://github.com/thinrope/fixed_sensor_visualization/blob/master/timeplot_all.gpl#L26
>
> plot for [ID in IDs] "tmp/" . ID . ".data" u 1:2 axes x1y2 w l lw 2
> title graph_title(ID);
>
> What I wanted to do is add another SMA filter on each datafile (or 2
> with different window) and still have it plot similar graph.
>
> so having defined SMA as in
> https://github.com/thinrope/fixed_sensor_visualization/blob/master/timeplot.gpl#L46
> I was planning to write something along:
>
> plot for [ID in IDs] a=sma_24_init(0), "tmp/" . ID . ".data" u
> 1:(sma_24($2)) axes x1y2 w l lw 2 title graph_title(ID);
I think that statement would work if you just remove the unnecessary comma
after the definition a=<something>.
Doesn't it?
Ethan
> IDs are list of numbers coming form the environment/Makefile, but can
> be strings.
>
> May be possible with `set table` and `do for [ID in IDs]{init; plot;}`
> but I'd rather avoid it.
>
>
> Alternatively, something along
>
> init_OK=0; f3(x,n) = (init_OK ? a=f1(n): 0, f2(x));
> plot for [n=1:3] a=f3(x,n);
> undefined variable: x
> :-|
>
> Kalin.
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
difficult for loop synax :-| Kalin Kozhuharov <me.kalin@gmail.com> - 2014-08-19 11:57 -0700
Re: difficult for loop synax :-| Ethan A Merritt <EAMerritt@gmail.com> - 2014-08-19 18:03 -0700
Re: difficult for loop synax :-| Kalin Kozhuharov <me.kalin@gmail.com> - 2014-08-19 23:15 -0700
Re: difficult for loop synax :-| Ethan A Merritt <sfeam@users.sourceforge.net> - 2014-08-20 10:15 -0700
Re: difficult for loop synax :-| Kalin Kozhuharov <me.kalin@gmail.com> - 2014-08-20 11:50 -0700
Re: difficult for loop synax :-| Ethan A Merritt <EAMerritt@gmail.com> - 2014-08-20 17:50 -0700
Re: difficult for loop synax :-| Kalin Kozhuharov <me.kalin@gmail.com> - 2014-08-20 23:02 -0700
csiph-web