GNU 绘图和动画(在 windows 上)
GNU plot and animation (on windows)
我想知道如何在 Gnuplot 上保存动画或每个情节。例如,在这个数据文件中:https://drive.google.com/file/d/10GexyqFWcEEmVTYnim-AAx8wya_uVhLC/view?usp=sharing
当我绘制 Fromm 方案“gnuplot plot_fromm.gnu”的结果然后按回车键时,我可以看到动画,但我想将其保存为 gif 文件或动画 png,或几个 png 文件以重新创建动画。
set yrange[-0.25:1.25];
plot 'transport000.dat' u 1:2 w l, 'transport000.dat' u 1:11 w lp;
pause -1;
plot 'transport001.dat' u 1:2 w l, 'transport001.dat' u 1:11 w lp;
pause 0.25;
plot 'transport002.dat' u 1:2 w l, 'transport002.dat' u 1:11 w lp;
pause 0.25;
plot 'transport003.dat' u 1:2 w l, 'transport003.dat' u 1:11 w lp;
pause 0.25;
plot 'transport004.dat' u 1:2 w l, 'transport004.dat' u 1:11 w lp;
pause 0.25;
plot 'transport005.dat' u 1:2 w l, 'transport005.dat' u 1:11 w lp;
pause 0.25;
plot 'transport006.dat' u 1:2 w l, 'transport006.dat' u 1:11 w lp;
pause 0.25;
plot 'transport007.dat' u 1:2 w l, 'transport007.dat' u 1:11 w lp;
pause 0.25;
plot 'transport008.dat' u 1:2 w l, 'transport008.dat' u 1:11 w lp;
pause 0.25;
plot 'transport009.dat' u 1:2 w l, 'transport009.dat' u 1:11 w lp;
pause 0.25;
plot 'transport010.dat' u 1:2 w l, 'transport010.dat' u 1:11 w lp;
pause 0.25;
我需要放
set terminal png
set output
在每个情节之前还是有其他方法?
两种 gnuplot 终端类型(例如输出模式)支持动画。
(1)gif动画已经支持多年
# delay is time between frames in units of 0.01 second (default = 5)
# loop <n> adds a request to loop only <n> times (may be ignored by the player)
set term gif animate {delay <d>} {loop <n>}
set output 'myanimation.gif'
FILE(i) = sprintf("transport%03d.dat", i)
do for [i=0:10] {
plot FILE(i) u 1:2 w l, '' u 1:11 w lp
}
unset output
(2)目前开发版也支持webp动画
Syntax:
set term webp
{size <x_pixels>,<y_pixels>}
{font <font>} {fontscale <scale>} {{no}enhanced}
{{no}transparent} {background <rgbcolor>
{linewidth <lw>} {rounded|butt|square} {dashlength <dl>}
{pointscale <ps>}
{{no}animate {quality <q>} {delay <msec>} {loop <n>}}
Individual frames produced by the webp terminal are first created as 32-bit
RGB + alpha channel images using routines shared with the pngcairo terminal.
See `set term pngcairo` for more details about font and terminal options.
The frames are then converted to webp format on output.
The `animate` option produces a webp file containing multiple frames,
each one created by a separate `plot` or `splot` command. The animation
sequence is terminated by the next `set output` or `set terminal` command.
`quality` (1..100) affects the size of the output file.
q values from 1 to 74 use lossy compression; smaller values produce a
smaller file at the cost of lost detail in the rendered image.
q values from 75 to 100 use lossless compression. All produce the same
image quality (lossless!). Larger values spend more computing time for
diminishing benefit in reduced file size.
The default is 75, lossless compression without excessive computation.
The `delay` suboption sets the delay time in milliseconds between frames
during playback (default 50 milliseconds).
The `loop` suboption specifies how many times the animation sequence should
be repeated during playback. The default (0) gives a continuous loop.
我想知道如何在 Gnuplot 上保存动画或每个情节。例如,在这个数据文件中:https://drive.google.com/file/d/10GexyqFWcEEmVTYnim-AAx8wya_uVhLC/view?usp=sharing 当我绘制 Fromm 方案“gnuplot plot_fromm.gnu”的结果然后按回车键时,我可以看到动画,但我想将其保存为 gif 文件或动画 png,或几个 png 文件以重新创建动画。
set yrange[-0.25:1.25];
plot 'transport000.dat' u 1:2 w l, 'transport000.dat' u 1:11 w lp;
pause -1;
plot 'transport001.dat' u 1:2 w l, 'transport001.dat' u 1:11 w lp;
pause 0.25;
plot 'transport002.dat' u 1:2 w l, 'transport002.dat' u 1:11 w lp;
pause 0.25;
plot 'transport003.dat' u 1:2 w l, 'transport003.dat' u 1:11 w lp;
pause 0.25;
plot 'transport004.dat' u 1:2 w l, 'transport004.dat' u 1:11 w lp;
pause 0.25;
plot 'transport005.dat' u 1:2 w l, 'transport005.dat' u 1:11 w lp;
pause 0.25;
plot 'transport006.dat' u 1:2 w l, 'transport006.dat' u 1:11 w lp;
pause 0.25;
plot 'transport007.dat' u 1:2 w l, 'transport007.dat' u 1:11 w lp;
pause 0.25;
plot 'transport008.dat' u 1:2 w l, 'transport008.dat' u 1:11 w lp;
pause 0.25;
plot 'transport009.dat' u 1:2 w l, 'transport009.dat' u 1:11 w lp;
pause 0.25;
plot 'transport010.dat' u 1:2 w l, 'transport010.dat' u 1:11 w lp;
pause 0.25;
我需要放
set terminal png
set output
在每个情节之前还是有其他方法?
两种 gnuplot 终端类型(例如输出模式)支持动画。
(1)gif动画已经支持多年
# delay is time between frames in units of 0.01 second (default = 5)
# loop <n> adds a request to loop only <n> times (may be ignored by the player)
set term gif animate {delay <d>} {loop <n>}
set output 'myanimation.gif'
FILE(i) = sprintf("transport%03d.dat", i)
do for [i=0:10] {
plot FILE(i) u 1:2 w l, '' u 1:11 w lp
}
unset output
(2)目前开发版也支持webp动画
Syntax:
set term webp
{size <x_pixels>,<y_pixels>}
{font <font>} {fontscale <scale>} {{no}enhanced}
{{no}transparent} {background <rgbcolor>
{linewidth <lw>} {rounded|butt|square} {dashlength <dl>}
{pointscale <ps>}
{{no}animate {quality <q>} {delay <msec>} {loop <n>}}
Individual frames produced by the webp terminal are first created as 32-bit
RGB + alpha channel images using routines shared with the pngcairo terminal.
See `set term pngcairo` for more details about font and terminal options.
The frames are then converted to webp format on output.
The `animate` option produces a webp file containing multiple frames,
each one created by a separate `plot` or `splot` command. The animation
sequence is terminated by the next `set output` or `set terminal` command.
`quality` (1..100) affects the size of the output file.
q values from 1 to 74 use lossy compression; smaller values produce a
smaller file at the cost of lost detail in the rendered image.
q values from 75 to 100 use lossless compression. All produce the same
image quality (lossless!). Larger values spend more computing time for
diminishing benefit in reduced file size.
The default is 75, lossless compression without excessive computation.
The `delay` suboption sets the delay time in milliseconds between frames
during playback (default 50 milliseconds).
The `loop` suboption specifies how many times the animation sequence should
be repeated during playback. The default (0) gives a continuous loop.