GNUPLOT - 堆叠图像的输出数组

GNUPLOT - Output Array of Stacked Images

在这个 post 的底部是 gnuplot 示例代码,它绘制了一个编号为 001 到 103 的 .dat 文件数组,并将它们转换为一个 .png 数组。下面是第一张和最后一张图

问题是,如何将 001 到 103 .png 相互堆叠并在此过程中生成包含 103 张图像的输出数组?到目前为止,我已经成功地制作了 一张 图像,它堆叠了从 001 到 103.dat 的所有组合数据。见下文

执行 one 堆叠图像的代码位已被注释掉

# Test.png - One merged data
#filename(n) = sprintf("ar-agn--DensT-%03.0f.dat", n)
#plot for [i=1:103] filename(i) using 1:2:3 with points pointtype 5 ps 0.3 palette notitle

但我需要的是一个 输出数组 个堆叠在一起的图像。

先谢谢大家!!!


#!/bin/bash

# Comment out the 3 lines below to produce all in one stacked image 
for FILE in ar-agn--DensT*.dat; do
gnuplot -p << EOF
set output "${FILE}.png"

set terminal png

# uncomment line below for all in one merged data
#set output "TEST.png" 

set datafile separator ","


set xlabel "x-units" font ",16"
set ylabel "y-units" font ",16"
set cblabel "y-units" font ",16"

set tics font ", 16"

set xzeroaxis 


#  Temp vs Density

set yr [0.0:8.0]
set xr [-3.0:6.0]

 set xlabel "log (Number density/(cm^{-3}) )"
 set ylabel "log (Temperature/ K )"

set cbrange [0.099949:10.2948]

set cblabel "Time (Myr)"

set palette  defined ( \
    0 '#0c0887' ,\
    1 '#4b03a1'   ,\
    2 '#7d03a8'   ,\
    3 '#a82296'    ,\
    4 '#cb4679'     ,\
    5 '#e56b5d'   ,\
    6 '#f89441'  ,\
    7 '#fdc328' ,\
    8 '#f0f921'  )

#  Series of subsequnt plots
plot  "${FILE}" u 1:2:3 with points pointtype 5 ps 0.3 palette notitle

# Test.png - One merged data
#filename(n) = sprintf("ar-agn--DensT-%03.0f.dat", n)
#plot for [i=1:103] filename(i) using 1:2:3 with points pointtype 5 ps 0.3 palette notitle


EOF

# insert comment into line below for all in one merged data
done

你们非常亲密。您需要两次迭代,一次在 plot 命令内部,一次在外部:

filename(n) = sprintf("ar-agn--DensT-%03.0f.dat", n)
outfile(n) = sprintf("ar-agn--DensT-%03.0f.png", n)

do for [N=1:103] {
    set output outfile(N) 
    plot for [i=1:N] filename(i) using 1:2:3 with points pointtype 5 ps 0.3 palette notitle
}