在gnuplot中绘制多个矩阵

时间:2015-04-13 20:56:58

标签: matrix gnuplot

我必须使用相同的配色方案绘制多个矩阵。目前我正在使用这个程序。

do for [i=0:10] {
  set term png
  set output 'sort'.i.'.png'
  unset key                               
  plot 'sort'.i.'.dat' matrix with image
}

这是绘制不同颜色方案的不同情节。

1 个答案:

答案 0 :(得分:0)

您必须为所有地块设置固定的cbrange。如果您事先知道此范围,则可以使用

进行设置
set cbrange[min:max]

开始循环文件之前。

如果您不知道范围,那么在进行绘图之前必须使用stats命令计算它:

max = min = 0
do for [i=0:10] {
  stats 'sort'.i.'.dat' matrix using 3 nooutput
  if (i == 0) {
    max = STATS_max
    min = STATS_min
  } else {
    if (STATS_max > max) { max = STATS_max }
    if (STATS_min < min) { min = STATS_min }
  }
}

set cbrange [min:max]

do for [i=0:10] {
  set term png
  set output 'sort'.i.'.png'
  unset key                               
  plot 'sort'.i.'.dat' matrix with image
}