gnuplot:在某个点用线连接两个数据 [英] Gnuplot: connecting two data with line at a certain point
本文介绍了gnuplot:在某个点用线连接两个数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个使用gnuplot和两个数据以混合方案的图.
I want a graph using gnuplot with two data in mixed scheme.
这是一个由3列组成的数据:
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.
From x=1 to x=5, use y1 value, then from x=6 to x=10 use y2 value.
而且,所有点都用一条直线相连.
And, all the points are connected with one single line.
有没有人知道如何使用简单的gnuplot命令来制作它?
Does any body know how to make it with simple gnuplot command?
推荐答案
Prue Gnuplot
解决方案:
Prue Gnuplot
soulution:
plot 'sheme.dat' u 1:($1<=5?$2:$3) w l
如果需要,您可以优化条件以处理x< 1和x> 10 ...的情况.
If you want, you can refine the condition to handle cases x<1 and x>10...
OR
如果要绘制y1的线 1-5和y2绘制6-10,请使用零列:
If you want to plot lines 1-5 with y1 and 6-10 with y2, use column zero:
plot 'sheme.dat' u 1:($0<=4?$2:$3) w l
这篇关于gnuplot:在某个点用线连接两个数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文