如何在gnuplot中存储变量并在xrange和set箭头中使用它 [英] How to store a variable in gnuplot and use it in xrange and in set arrow

查看:63
本文介绍了如何在gnuplot中存储变量并在xrange和set箭头中使用它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是gnuplot的新手,不知道如何在gnufi​​le的开头存储变量,然后在gnuscript的其余部分中使用它.

I am new to gnuplot and do not know how to store a variable at the start of gnufile and then use it in rest partof the gnuscript.

x范围的最大值等于文件第四列的最后一行,并且在每个新的摘要大小中都不同.在终端上,我可以通过tail -n 1 data打印最大xrange.awk'{print $ 4}',给出一个数字,说它是3.83352.

The maximum of x-range is equal to the last row in forth column of a file and it varies in every new excersize. On terminal I can print the maximum xrange by tail -n 1 data.dat | awk '{print $4}' which is giving a number say it is 3.83352.

我尝试使用代码

MAX_XTICK="`tail -n 1 data.dat | awk '{print $4}'`"

,然后尝试在xrange中将其用作

and then tried to use it in xrange as

set xrange [ 0 : "$MAX_XTICK"]

但是它给了我错误以下的错误plot.gnu",第64行:无法以空的x范围进行绘图!

but it is giving me error below error plot.gnu", line 64: Can't plot with an empty x range!

我希望在xrange中将MAX_XTICK变量用作

I am expecting to use MAX_XTICK variable in xrange as

xrange [ 0 : MAX_XTICK].

推荐答案

无需外部脚本.选中帮助统计信息 help显示变量.

No need for external scripts. Check help stats and help show variables.

stats "data.dat" u 4

set xrange [0:STATS_max]

在上面的示例中,执行 stats 命令后,gnuplot变量 STATS_max 包含第四列的最大值.

In the above example, after performing the stats command, the gnuplot variable STATS_max contains the maximumm of the 4th column.

这篇关于如何在gnuplot中存储变量并在xrange和set箭头中使用它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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