如何解决GNUPLOT replot问题

时间:2013-11-02 09:16:06

标签: gnuplot

我设置了一个像这样的多重时段:

set terminal wxt size 1500,900
set format x "%d%m%y %H:%M:%S"
set xdata time
set timefmt x "%Y%m%dT%H%M%S"
set key font ",6"
set lmargin 10
set rmargin 10
set multiplot layout 2,1
plot "output.txt" u 1:2 w lines axes x1y1, \
"output.txt" u 1:3 w lines axes x1y2
plot "output.txt" u 1:40 w lines axes x1y1, \
"output.txt" u 1:39 w lines axes x1y2
set y2tics border
unset multiplot

哪个有效,给我2个图,一个在另一个之上。

但是按下“replot”按钮(或使用缩放)会导致第二个图填满窗口 - 完全隐藏第一个图。

3 个答案:

答案 0 :(得分:3)

是的,这就是replot的行为方式。文档说:“请注意,在多色模式下,重新绘制只能重现最新的组件图,而不是完整集。”

所以,你可以做的是将整个set multiplot ... unset multiplot内容放在外部文件中,load,然后再load。或者将这些东西放在一个字符串中并eval多次。

答案 1 :(得分:1)

我有同样的问题。用循环解决了它:



set term wxt enh

do for [IDX = 0:1] {

  if (IDX==1) {
    set terminal png enhanced
    set output 'temp.png'
  }

  set multiplot

  set size 1,1
  set origin 0,0
  plot sin(x)

  set size 0.5,0.35
  set origin 0.13,0.63
  plot cos(x)

  unset multiplot
}

set output
set term wxt enh




答案 2 :(得分:1)

这是另一种解决方法。它没有直接回答这个问题,但它可以提出其他类似问题的想法。将标题和页脚重新读取,然后可以选择两个上下文来表示类似的多重图(完成两次)

if (exists("rehearse")) rehearse=1+rehearse; set term x11
if (!exists("rehearse")) rehearse=0; set term png; set output sprintf("test_palette_%s.png", system("date +\"%F\""))

pr "rehearse=".rehearse; show term #<= comment printing
set samples 100;  set isosample 100,100
set xrange [0:1]; set yrange [0:1]
set palette defined (0 "white", 1 "red")
set autoscale cbfix; unset colorbox; unset key

set multiplot layout 2,2   
plot '++' using 1:2:1 with image
plot '++' using 1:2:2 with image
plot '++' using 1:2:(-$1) with image
plot '++' using 1:2:(-$2) with image
unset multiplot

if(rehearse <  1) reread
相关问题