admin管理员组

文章数量:1295901

I found a github containing a Voice Activity Detection algorithm here. the implementation takes in a simple list of doubles (file = sound.txt), and outputs several text files, containing 2 columns of data (files = example_.txt)

It contains an older gnuplot script to display a multiplot. However, this script needs revising with the new gnuplot

Here's the script:

$ gnuplot
$ > set multiplot
$ > plot "sound.txt" with 1:2 lines
$ > filename(n) = sprintf("example_%d.txt", n)
$ > plot for [i=1:10] filename(i) using 1:2 with lines

Can anyone figure out what this script is trying to do, and update it to the new syntax?

Thanks, Charles.

I found a github containing a Voice Activity Detection algorithm here. the implementation takes in a simple list of doubles (file = sound.txt), and outputs several text files, containing 2 columns of data (files = example_.txt)

It contains an older gnuplot script to display a multiplot. However, this script needs revising with the new gnuplot

Here's the script:

$ gnuplot
$ > set multiplot
$ > plot "sound.txt" with 1:2 lines
$ > filename(n) = sprintf("example_%d.txt", n)
$ > plot for [i=1:10] filename(i) using 1:2 with lines

Can anyone figure out what this script is trying to do, and update it to the new syntax?

Thanks, Charles.

Share edited Feb 12 at 3:50 Charles Martin asked Feb 12 at 3:44 Charles MartinCharles Martin 876 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

That script looks pretty recent to me, and is missing only the unset multiplot to close off the figure. As written, all 11 plots are drawn on top of each other to make a superposition of "sound.txt" with 10 examples. I don't know whether that is the actual intent.

If you instead want to make a figure with all 11 plots drawn separately in a column, each one spanning the width of the page and occupying ~1/11 of the vertical space you could modify it to something like this. If the individual files do not span an identical range of x values (column 1 data) they may not line up properly unless you explicitly state the desired x range.

filename(n) = sprintf("example_%d.txt", n)
set xrange [0:whatever]

set multiplot layout 11, 1
plot "sound.txt" with 1:2 lines    
do for [i=1:10] {
    plot filename(i) using 1:2 with lines
}
unset multiplot

本文标签: Need old gnuplot script interpretationStack Overflow