带有错误栏和线点的 GNUplot 混合图
GNUplot Mixed Graph with errorbar and linespoints
我的数据文件为 ;
#"U"
17.90 17.92 0.03
17.91 17.93 0.03
#"M"
11.22 16.71 0.02
11.44 16.64 0.02
#"T"
33.22 16.36 0.01
22.3 16.34 0.01
我想画 1:2 第三个是 y 轴上的错误。我希望这些作为有错误的线点,所以我使用代码:
plot 'doc.dat' u 1:2:3 w yerrorbars ls 1 i 0 t "U", '' u 1:2:3 w yerrorbars ls 2 i 1 t "M", '' u 1:2:3 w yerrorbars ls 3 i 2 t "T"
但出现错误。我不明白我哪里做错了。
如 gnuplot help index
所述:数据集由成对的空白记录分隔。
所以要使用索引,您需要将数据文件更改为:(注意双空格)
#"U"
17.90 17.92 0.03
17.91 17.93 0.03
#"M"
11.22 16.71 0.02
11.44 16.64 0.02
#"T"
33.22 16.36 0.01
22.3 16.34 0.01
那么根据@Matthew的建议,关于你的剧情线,你需要改为:
plot 'doc.dat' i 0 u 1:2:3 w yerrorbars ls 1 t "U", '' i 1 u 1:2:3 w yerrorbars ls 2 t "M", '' i 2 u 1:2:3 w yerrorbars ls 3 t "T"
注:
删除注释对脚本有很大帮助:
"U"
17.90 17.92 0.03
17.91 17.93 0.03
"M"
11.22 16.71 0.02
11.44 16.64 0.02
"T"
33.22 16.36 0.01
22.3 16.34 0.01
您可以将脚本简化为:
set key autotitle columnhead
plot for [a=0:2] "doc.dat" i a w yerr
或者通过自动计算块数更好:
set key autotitle columnhead
stats "doc.dat"
plot for [a=0:STATS_blocks] "doc.dat" i a w yerr
最后,如果你想要两个误差线和点之间的直线,plot
线变成:
plot for [a=0:STATS_blocks] "doc.dat" i a w l, for [a=0:STATS_blocks] "" i a w yerr pt 0
看看 gnuplot
中的 help stats
和 help for
我的数据文件为 ;
#"U"
17.90 17.92 0.03
17.91 17.93 0.03
#"M"
11.22 16.71 0.02
11.44 16.64 0.02
#"T"
33.22 16.36 0.01
22.3 16.34 0.01
我想画 1:2 第三个是 y 轴上的错误。我希望这些作为有错误的线点,所以我使用代码:
plot 'doc.dat' u 1:2:3 w yerrorbars ls 1 i 0 t "U", '' u 1:2:3 w yerrorbars ls 2 i 1 t "M", '' u 1:2:3 w yerrorbars ls 3 i 2 t "T"
但出现错误。我不明白我哪里做错了。
如 gnuplot help index
所述:数据集由成对的空白记录分隔。
所以要使用索引,您需要将数据文件更改为:(注意双空格)
#"U"
17.90 17.92 0.03
17.91 17.93 0.03
#"M"
11.22 16.71 0.02
11.44 16.64 0.02
#"T"
33.22 16.36 0.01
22.3 16.34 0.01
那么根据@Matthew的建议,关于你的剧情线,你需要改为:
plot 'doc.dat' i 0 u 1:2:3 w yerrorbars ls 1 t "U", '' i 1 u 1:2:3 w yerrorbars ls 2 t "M", '' i 2 u 1:2:3 w yerrorbars ls 3 t "T"
注:
删除注释对脚本有很大帮助:
"U"
17.90 17.92 0.03
17.91 17.93 0.03
"M"
11.22 16.71 0.02
11.44 16.64 0.02
"T"
33.22 16.36 0.01
22.3 16.34 0.01
您可以将脚本简化为:
set key autotitle columnhead
plot for [a=0:2] "doc.dat" i a w yerr
或者通过自动计算块数更好:
set key autotitle columnhead
stats "doc.dat"
plot for [a=0:STATS_blocks] "doc.dat" i a w yerr
最后,如果你想要两个误差线和点之间的直线,plot
线变成:
plot for [a=0:STATS_blocks] "doc.dat" i a w l, for [a=0:STATS_blocks] "" i a w yerr pt 0
看看 gnuplot
中的help stats
和 help for