Gnuplot:如何禁用“警告:使用‘未知’终端进行绘图。”?

问题描述 投票:0回答:1

在 Gnuplot 文件中,我使用以下“子例程”文件来计算某个表的维度:

# Sets:
# size_x ,min_x, max_x,
# size_y, min_y, max_y.

# Dummy plot to get statistical properties without
# having "stats" command like with v4.4.4.

set terminal unknown
# Works with v4.4
# if ($# == 1) plot $0 using 1:2; else plot $0 using $1

# Works with v5.5
if (ARGC == 1) plot ARG1 using 1:2; else plot ARG1 using @ARG2

min_x = GPVAL_DATA_X_MIN
max_x = GPVAL_DATA_X_MAX
min_y = GPVAL_DATA_Y_MIN
max_y = GPVAL_DATA_Y_MAX

size_x = max_x - min_x
size_y = max_y - min_y

所以有一个故意的

set terminal unknown
,因为脚本不应该显示任何内容,而只是计算一些值。

我在 Gnuplot 提示符下尝试了

set terminal
,但似乎没有虚拟或空终端...

有办法消除该消息吗?

我目前正在使用 Gnuplot v5.4.2。

gnuplot suppress-warnings
1个回答
0
投票

如果您使用 gnuplot 5.4.2,那么只需使用

stats
即可(v4.4 中不可用)

stats "myFile.dat" u 1:2 noouput

size_x = STATS_max_x - STATS_min_x
size_y = STATS_max_y - STATS_min_y

print size_x, size_y
© www.soinside.com 2019 - 2024. All rights reserved.