gpt4 book ai didi

gnuplot gif 图像 : is there a way to make title dynamic?

转载 作者:行者123 更新时间:2023-12-05 03:18:51 24 4
gpt4 key购买 nike

我正在尝试创建一个带有动态标题的 gif,该标题为每一帧采用列标题。

代码:

set terminal gif animate delay 20
set output 'gse.gif'
set cbrange [0:0.00025]
set xrange [-0.3:0.3]
set yrange [-0.3:0.3]
set ylabel "z (m)"
set xlabel "x (m)"
set cblabel "grain size"
set rmargin at screen 0.8

do for [i=0:10] {
plot 'gse.dat' index i with image title columnheader(1)
}

与数据集:

"Time: 0 years"
-0.2475 -0.546333 1e-05
-0.2425 -0.546333 1e-05
-0.2375 -0.546333 1e-05
-0.2325 -0.546333 1e-05
-0.2275 -0.546333 1e-05
-0.2225 -0.546333 1e-05
-0.2175 -0.546333 1e-05
-0.2125 -0.546333 1e-05
...


"Time: 162 years"
-0.247513 -0.546305 1e-05
-0.242512 -0.546305 1e-05
-0.237512 -0.546305 1e-05
...


"Time: 1674 years"
-0.247631 -0.546045 1e-05
-0.242628 -0.546045 1e-05
-0.237625 -0.546045 1e-05
...

产生:

enter image description here

我希望它能像这样设置标题:

enter image description here

但每个帧的值取自第一列标题。

附言如果这样更方便,我也会考虑更改数据集格式。

最佳答案

当然,有办法。你已经很接近了。简短的回答是:添加一行,例如

设置键中心tmargin

键/图例的默认位置是“右上角”。但是,我猜它被 with image 图覆盖了。所以,如果你设置例如set key center tmargin 您会在图表上方看到它。检查帮助键

脚本:

### animated gif with variable title
reset session

# create some test data
set samples 11
set isosamples 11
set print $Data
do for [t=0:10] {
print sprintf('"Time: %d years"',t)
do for [y=0:10] for [x=0:10] {
print sprintf("%g %g %g",y,x,x*y+t*4)
}
print ""; print "" # two empty lines
}
set print

set xrange[:] noextend
set yrange[:] noextend
set cbrange[0:120]

set term gif size 600,360 animate delay 40
set output "SO73598093.gif"

set key center tmargin

do for [i=0:10] {
plot $Data u 1:2:3 index i w image title columnheader(1)
}
set output
### end of script

结果:

enter image description here

关于gnuplot gif 图像 : is there a way to make title dynamic?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73598093/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com