如何从文件中绘制对象(矩形) [英] how to draw objects (rect) from a file

查看:58
本文介绍了如何从文件中绘制对象(矩形)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gnuplot中,我可以通过绘制一个矩形

In gnuplot i can draw a rectangle via

set object rect from x0,y0 to x1,y1

如何从文件中读取坐标x0,x1,y0,y1?

How to read the coordinates x0,x1,y0,y1 from a file?

推荐答案

一种方法是将设置矩形的代码行放入一个单独的文件,然后从gnuplot脚本中调用该文件.因此,您有一个名为"coord.txt"的文件,其中包含一行

One way would be to put the line of code that sets the rectangle into a separate file and call that file from within the gnuplot script. So you have a file called "coord.txt" that contains the one line

set object rect from 2,2 to 4,40

,并且您有一个名为"rect.gp"的gnuplot脚本,该脚本显示为

and you have a gnuplot script called "rect.gp" that says

set title "call rectangle coordinates"
load "coord.txt"
plot x**2

如果现在从gnuplot类型中输入load "rect.gp",您将获得带有矩形的图形.

If you now from within gnuplot type load "rect.gp" you get your graph with the rectangle.

这可能与您要寻找的不完全相同,但也许是第一步.

That may not be exactly what you are looking for but maybe a first step.

这篇关于如何从文件中绘制对象(矩形)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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