gnuplot:使用“图0”。并“图1”绘制矩形时

发布于 2025-01-28 23:36:10 字数 778 浏览 1 评论 0原文

“图1”的一些启发感到高兴

我对使用“图0”和 图0和图1表示左右边界。

我正在关注第二个示例 http://gnuplot.sourplot.sourceforge.net/demo/retectangle。 html

reset session
set xrange [0:6]
set yrange [0:25]

set obj 1 rect from graph 0,graph 0 to graph 1,graph 1 fc "red"   # paint the background

set obj 2 rect from graph 0,5 to graph 1,12 fc "green"            # produces nothing

set obj 3 rect from 'graph 0', 3 to 'graph 1',10 fc "blue"        # produces nothing 

set obj 4 rect from 'graph 0', 4 to 6,8 fc "yellow"               # this works. '...' and 6 required 

plot 'data02.txt'

我想念什么?

我的gnuplot是Ubuntu 20.04.4 LTS上的5.2.8,

感谢您的帮助!

I'd be happy about some enlightenment on the use of "graph 0" and "graph 1":

Goal is to draw rectangles into a graph, but while painting the whole background works, horizontal stripes don't, when I try to use graph 0 and graph 1 to indicate the left and right boundaries.

I'm following the second example at http://gnuplot.sourceforge.net/demo/rectangle.html

reset session
set xrange [0:6]
set yrange [0:25]

set obj 1 rect from graph 0,graph 0 to graph 1,graph 1 fc "red"   # paint the background

set obj 2 rect from graph 0,5 to graph 1,12 fc "green"            # produces nothing

set obj 3 rect from 'graph 0', 3 to 'graph 1',10 fc "blue"        # produces nothing 

set obj 4 rect from 'graph 0', 4 to 6,8 fc "yellow"               # this works. '...' and 6 required 

plot 'data02.txt'

What am I missing?

My gnuplot is 5.2.8 on Ubuntu 20.04.4 LTS

Thanks for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七分※倦醒 2025-02-04 23:36:10

为什么要编写例如'图表0'而不是图形0
并检查帮助坐标

如果未指定X的坐标系,则首先使用。如果是
未指定Y的系统,采用X的系统。

因此,例如图0,5图0,12将在图形外。您应该编写图0,第一个5图0,第一个120,50,12如果您是指X-和Y-Coordine。实际上,在您的情况下,图形0第一个0相同。因此,这取决于您想要的。

检查以下脚本。

脚本:

### coordinate sytems graph and first
reset session

set xrange [0:6]
set yrange [0:25]

set obj 1 rect from graph 0,       0 to graph 1,        1 fc "red"
set obj 2 rect from graph 0, first 5 to graph 1, first 12 fc "green"
set obj 3 rect from graph 0, first 3 to graph 1, first 10 fc "blue"
set obj 4 rect from graph 0, first 4 to       6,        8 fc "yellow"

plot NaN notitle   # or plot some data
### end of script

结果:

”在此处输入图像描述”

Why do you write e.g. 'graph 0' instead of graph 0?
And check help coordinates:

If the coordinate system for x is not specified, first is used. If the
system for y is not specified, the one used for x is adopted.

Hence, e.g. graph 0, 5 and graph 0, 12 will be outside of the graph. You should write graph 0, first 5 and graph 0, first 12 or 0,5 and 0,12 if you mean the x- and y-coordinates. Actually, in your case graph 0 is identical with first 0. So, it depends what you want.

Check the following script.

Script:

### coordinate sytems graph and first
reset session

set xrange [0:6]
set yrange [0:25]

set obj 1 rect from graph 0,       0 to graph 1,        1 fc "red"
set obj 2 rect from graph 0, first 5 to graph 1, first 12 fc "green"
set obj 3 rect from graph 0, first 3 to graph 1, first 10 fc "blue"
set obj 4 rect from graph 0, first 4 to       6,        8 fc "yellow"

plot NaN notitle   # or plot some data
### end of script

Result:

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文