使用变量定义列时缩放多图 [英] Scaling of multiplot while using variables to define the column

查看:44
本文介绍了使用变量定义列时缩放多图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从脚本stuff.pl获取数据,并希望将其动态绘制到一个图形中.因此,我将在Gnuplot(v4.6补丁程序级别3)中使用一个循环,这将导致以下问题:

I am getting data from a script stuff.pl and want to plot dynamically into one graph. So I am going to use a loop in Gnuplot (v4.6 patchlevel 3) which leads me to following problem:

使用文件TEST.gp:

xCol=2; yCol=3
set term x11 1
plot '< stuff.pl' u xCol:yCol

xCol=4; yCol=5
set term x11 1
set autoscale y
replot '< stuff.pl' u xCol:yCol

pause 1

并通过gnuplot TEST.gp运行它,我的图形无法正确缩放.该图仅显示第二个图形(缩放为其值).

and run it via gnuplot TEST.gp my graph isn't scaled proper. The plot is just showing the second graph (scales to its values).

如果我使用

plot '< stuff.pl' u 2:3
replot '< stuff.pl' u 4:5

,应该具有相同的imo,缩放有效.

, which should behave the same imo, the scaling works.

我不了解这种行为.

推荐答案

replot调用前一个plot命令,然后添加另一个图.在上一个plot命令中,变量没有被替换.当replot调用上一个绘图命令时,两个绘图都使用xColyCol的最后一个值!

The replot calls the previous plot command and then adds another plot. In the previous plot command the variables haven't been replaced. When the replot calls the previous plot command, the last values of xCol and yCol are used for both plots!

您可以使用两个不同的变量:

You can either use two different variables:

xCol1 = 2; yCol1 = 3
plot '< stuff.pl' u xCol1:yCol1

xCol2 = 4; yCol2 = 5
replot '< stuff.pl' u xCol2:yCol2

或者您可以使用被替换的宏

or you can use macros, which are replaced

set macros
cols='2:3'
plot '< stuff.pl' u @cols

cols='4:5'
replot '< stuff.pl' u @cols

这篇关于使用变量定义列时缩放多图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆