Daniel
Daniel

Reputation: 13

Plotting data included in script fails in loop

I would like to plot data points included inside a script file. This should be done multiple times (plotting to different files). Therefore, I am using a do-for-loop.

This loop let's Gnuplot freeze on excution. Could you please hint me to the cause?

This is my MWE:

reset
set autoscale

do for [index=1:1] {
plot "-" with lines ls 2 notitle
0.500 5
1.000 6
1.500 7
e
}

Upvotes: 1

Views: 385

Answers (1)

Christoph
Christoph

Reputation: 48390

Yes, seems like the combination of do for with inline data isn't supported. It also wouldn't be very convenient, since this would require a separate data block for every iteration like in

set style data linespoints
plot '-' using 1:2, '-' using 1:3
1 2 3
4 5 6
e
1 2 3
4 5 6
e

With version 5.0 inline data blocks were introduced which allow reusing inline data:

$data <<EOD
1 2 3
4 5 6
EOD
do for [i=2:3] {
    plot $data using 1:i w l
    pause -1
}

Upvotes: 1

Related Questions