在gnuplot中绘制带有线条的误差条

3

我有一个文件,其中记录了模拟的交付率及其置信区间。我需要在图表上绘制误差线。需要将折线图和误差线绘制在同一张图表上。

样本数据:

V   D         IC
10 99.2373 0.000200729
30 97.2515 0.00649952
60 94.6761 0.00950475

我希望它看起来像下面的示例一样:

Example

Here is my code:

set nokey
set grid
set key right inside
set xlabel 'Velocidade em Km/h'
set ylabel 'Taxa de Entrega'
set autoscale
set yr[0:100]
set style data lines
plot 'taxa_entrega-AODV-50-250.txt' using 1:2:($2-$3):($2+$3) with yerrorbars

你已经尝试过哪些gnuplot代码? - theozh
set nokey set grid set key right insideset xlabel 'Velocidade em Km/h' set ylabel 'Taxa de Entrega' set autoscale set yr[0:100] set style data lines绘图 'taxa_entrega-AODV-50-250.txt' using 1:2:($2-$3):($2+$3) with yerrorbars - Danilo Renato De Assis
2个回答

2
如果您正在绘制误差条,通常会使用with points绘制数据,但不一定要使用连接的lineslinespoints>。相反,您可以添加由模型或拟合描述的线。 然而,从您提到的图像中,我假设您仍然想要连接这些点。因此,只需将相同的数据''再次添加为线即可。
plot 'taxa_entrega-AODV-50-250.txt' using 1:2:($2-$3):($2+$3) with yerrorbars,\
    '' using 1:2 with lines

追加说明:请参考下面的完整代码。我注释掉了set yrange[0:100],因为否则你提供的数据不太容易看清楚。此外,你的误差栏在0.0002到0.009的范围内。相对于值94.6到99.2,这些将不是条形图而更像点。

注意:'errobars'指误差栏,'bars'指条形图,'points'指点状图。

reset session
set nokey 
set grid 
set key right inside 
set xlabel 'Velocidade em Km/h' 
set ylabel 'Taxa de Entrega' 
set autoscale 
# set yrange[0:100] 
set style data lines 

plot 'taxa_entrega-AODV-50-250.txt' using 1:2:($2-$3):($2+$3) with yerrorbars,\
    '' using 1:2 with lines

enter image description here


好的。我希望在图表中显示连接误差线,就像上面的示例一样。你向我展示的方法只有一个点。 - Danilo Renato De Assis
你确定例如值94.6的误差棒为0.009吗?这将不是一个棒而更像是一个点。 - theozh

0

虽然有点晚了,但我希望有人会发现这个有用。 实际上,Gnuplot已经内置了errorlines。 它将中心点与所要求的线连接起来。

当使用errorbars时,连接的线被简单地省略了。因此,errorbars是对应于points样式的,而errorlines则是对应于linespoints样式的。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接