Question

I have a data file separated by two lines. Each section of data is ~50 lines. I'm trying to make a .gif file. I know how to plot them individually or in a group but can't get the .gif to work.

My problem is similar to the one worked out by Glen MacLachlan in his youtube channel, part 5. Instead of 1 point, I have ~50 data points for each data section. He solves the problem by utilizing $index feature, and I tried to do the same but mine doesn't work.

What am I missing? Do I really have to plot the data separately into .png files and group them together to get .gif file?

What I've done:::

I edited the data file. Previously there were two columns x, and y. Now, I have them in 2nd and 3rd column, and the first column is index from 0 to 50. Each block of data has similar index.

bash script to create plot file

for ((i=0;i < 50; i++)) do echo "plot 'data.txt' 
u 2:3 w circles index $i"; done >>simulate.plt

It just plots ALL the data points

Was it helpful?

Solution

Why don't you show what you have tried?

The following should work fine:

set terminal gif animate delay 100
set output 'foobar.gif'
stats 'datafile' nooutput
set xrange [-0.5:1.5]
set yrange [-0.5:5.5]

do for [i=1:int(STATS_blocks)] {
    plot 'datafile' index (i-1) with circles
}

with the file datafile:

0
1


2
3


4
5

gives

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top