如何在gnuplot行中添加间隙? [英] How to add a gap in gnuplot line?
问题描述
我有一个gnuplot线图.我想在行中添加一个空格(中断)以表示缺少数据.我该怎么办?
I have a gnuplot line plot. I'd like to add a gap (break) in the line to signify lack of data. How can I do that?
例如,假设我的数据介于x = 10-> 100和200-> 500之间.所以我要在10和100之间设置一条线(同一条线,以便图例匹配),然后在100和200之间设置一条间隙,再在200和500之间设置一条线.
For example, let's say I have data between x=10->100, and also 200->500. So I want a line (the same line, so the legend matches) between 10 and 100, then a gap between 100 and 200, and again the line between 200 and 500.
我尝试添加空数据点(即-
y值),但是gnuplot高兴地对这些点进行插值.
I have tried adding empty datapoints (i.e. -
y values), but gnuplot happily interpolates those points.
推荐答案
两者之间有一个非常细微的区别:
There's a very subtle difference between:
plot 'data' u 1:2 w lines
和
plot 'data' u 1:($2) 2 lines
就您而言,我认为应该这样做:
In your case, I think it should work to do:
set datafile missing '-'
plot 'data' u 1:($2) w lines
(注意:这将导致与我将在下面描述的空白行方法产生细微的差异).
(Note: this results in a subtlely different plot than the blank line method I'll describe next).
另一种实现方法是在数据文件中要保留空白的地方绘制一条空白行.
Another way to do it is to just plot a blank line in the datafile where you want to have a gap.
例如:
#data
10 15
20 30
100 17
200 25
300 12
500 16
,然后使用plot 'data' u 1:2 w lines
或plot 'data' u 1:($2) w lines
进行绘制.两者都应产生相同的情节.
and then plot with either plot 'data' u 1:2 w lines
or plot 'data' u 1:($2) w lines
. Both should produce an identical plot.
有关更多信息,请参见gnuplot中的help missing
.
for more information, see help missing
in gnuplot.
这篇关于如何在gnuplot行中添加间隙?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!