gnuplot:通过不同数据文件在特定点用线连接两个数据 [英] Gnuplot: connecting two data with line at a certain point from different data files

查看:89
本文介绍了gnuplot:通过不同数据文件在特定点用线连接两个数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题是扩展名我想要一个在混合方案中使用gnuplot和两个数据的图.这是一个由3列组成的数据:

I want a graph using gnuplot with two data in mixed scheme. This is a data consisting of 3 columns:

#x   y1   y2
1   0    1    
2   0    1    
3   0    1    
4   0    1    
5   0    1    
6   0    1    
7   0    1    
8   0    1    
9   0.1  1.2
10  0.1  1.23

我要的是画一条没有接缝的线.例如

What I want is that one line draws without seam. e.g.

从x = 1到x = 5,使用y1值,然后从x = 6到x = 10,使用y2值.

From x=1 to x=5, use y1 value, then from x=6 to x=10 use y2 value.

而且,所有点都用一条直线连接.有没有人知道如何使用简单的gnuplot命令做到这一点?

And, all the points are connected with one single line. Does any body know how to make it with simple gnuplot command?

还有一个相关问题.如果将第3列中的数据分隔到其他文件(例如sheme2.dat),我该如何使用纯gnuplot命令绘制同一图形?

推荐答案

如果您绝对要使用纯Gnuplot,则可以使用变量作弊(但我建议您重新考虑问题):

If you absolutely want to use pure Gnuplot you can cheat a little with variables(, but I suggest you to rethink the problem):

set term unknown

plot 'sheme.dat' u 1:2 every ::::4
x0=GPVAL_DATA_X_MAX
y0=GPVAL_DATA_Y_MAX

plot 'sheme2.dat' u 1:2 every ::5
x1=GPVAL_DATA_X_MIN
y1=GPVAL_DATA_Y_MIN

set term wxt
# or png or qt or...

set arrow 1 from x0,y0 to x1,y1 nohead lc 1
plot 'sheme.dat' u 1:2 every ::::4 w l lc 1
replot 'sheme2.dat' u 1:2 every ::5 w l lc 1

这是一种用箭头连接最后一个数据点和第一个数据点的棘手方法,但是此问题的条件是如此特殊.

This is a tricky way to connect the last and first data points with an arrow, but the conditions of this problem are so specific.

这篇关于gnuplot:通过不同数据文件在特定点用线连接两个数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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