How can I display the current simulation time on my heatmap animation with Gnuplot? [duplicate]
Solution using current version of gnuplot (5.4)
DATA = "plot_para_heat_3D_insta.dat"
set key center at screen 0.5, 0.95
set key samplen 0
do for [i=1:int(STATS_blocks)]{
splot DATA index (i-1) using 1:2:(t=$3,$4) with pm3d title sprintf("time = %g",t)
}
This will set the variable t
to the content of column 3 for every point evaluated. After all points have been evaluated the column 3 value of the last point is still sitting in t
so you can use it to construct a title for the plot.
If you have an earlier version of gnuplot
the same trick is possible but it requires an extra dummy plot command that loads t
but doesn't plot anything.
do for [i=1:int(STATS_blocks)]{
splot DATA index (i-1) every 1::1::1 using (t=$3):(NaN):(NaN) notitle, \
DATA index (i-1) using 1:2:4 with pm3d title sprintf("time = %g",t)
}