Gif Animation in Gnuplot

喜夏-厌秋 提交于 2019-12-29 04:51:08

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/22898971/gif-animation-in-gnuplot

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!