|
From: Ethan A M. <EAM...@gm...> - 2014-12-08 02:23:59
|
On Sunday, 07 December 2014 01:18:56 PM Jacob Gerlach wrote:
> Hi list,
>
> I have several datafiles, which I'd like to plot together on one plot as
> smooth lines, but I'd also like to highlight each maximum
>
> With one file, I'm able to do
>
> plot 'file' smooth csplines
> stats 'file'
> replot file every::STATS_index_max::STATS_index_max notitle
>
> And get what I want.
> I tried expanding this with loops:
>
> filenames = "one two three four"
>
> plot for [file in filenames] file.".txt" \
> smooth csplines
>
> do for [n=1:4] {
> file=word(filenames,n).'.txt'
> stats file
> replot file every ::STATS_index_max::STATS_index_max notitle
> }
>
> This plots the csplines fine, but when replotting, I get four occurrences of
> warning: Skipping unreadable file "four"
>
> It seems this is some sort of name conflict by reusing the variable files;
> I was able to solve this by using a different variable, but I'd like to
> understand what happened.
>
> Even after changing the file name, I don't get four separate maxima.
> Instead, I get the maximum from "four" plotted four times.
>
> Is it possible to do this with loops or do I need to write one big plotting
> command to do it all at once?
files = "one two three four"
do for [name in files] {
stats name.'.txt' using 1 prefix name
}
plot for [name in files] name.'.txt' every :: name."_index_max" :: name."_index_max", \
for [name in files] name.'.txt'
But probably I would do it differently. Something like
set for [name in files] arrow from name."index_max", 0 to name."_index_max", name."_max"
plot for [name in filex] name.'.txt' using 1
Ethan
|