在 gnuplot 中,我可以通过绘制一个矩形
set object rect from x0,y0 to x1,y1
Run Code Online (Sandbox Code Playgroud)
如何从文件中读取坐标 x0,x1,y0,y1?
一种方法是将设置矩形的代码行放入一个单独的文件中,并从 gnuplot 脚本中调用该文件。所以你有一个名为“coord.txt”的文件,其中包含一行
set object rect from 2,2 to 4,40
Run Code Online (Sandbox Code Playgroud)
你有一个名为“rect.gp”的 gnuplot 脚本,上面写着
set title "call rectangle coordinates"
load "coord.txt"
plot x**2
Run Code Online (Sandbox Code Playgroud)
如果您现在在 gnuplot 中输入,load "rect.gp"您将得到带有矩形的图表。
这可能不完全是您正在寻找的,但也许是第一步。