Gnuplot 中的 Gif 动画 [英] Gif Animation in Gnuplot

查看:32
本文介绍了Gnuplot 中的 Gif 动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由两行分隔的数据文件.每段数据约 50 行.我正在尝试制作一个 .gif 文件.我知道如何单独或在一组中绘制它们,但无法让 .gif 工作.

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.

我的问题类似于 Glen MacLachlan 在他的 youtube 频道第 5 部分中解决的问题.每个数据部分我有大约 50 个数据点,而不是 1 点.他通过使用 $index 功能解决了这个问题,我尝试做同样的事情,但我的不起作用.

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.

我错过了什么?我真的必须将数据分别绘制成 .png 文件并将它们组合在一起以获得 .gif 文件吗?

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

我做了什么:::

我编辑了数据文件.以前有两列 x 和 y.现在,我将它们放在第 2 和第 3 列中,第一列是从 0 到 50 的索引.每个数据块都有相似的索引.

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脚本

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

它只是绘制所有数据点

推荐答案

你为什么不展示你已经尝试过的东西?

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
}

文件datafile:

0
1


2
3


4
5

给予

这篇关于Gnuplot 中的 Gif 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆