gnuplot with errorbars plotting

こ雲淡風輕ζ 提交于 2019-12-20 09:37:46

问题


The data in my "file.txt" file are as in the following (sample row shown)

31 1772911000 6789494.2537881

Note that the second column is the mean and the third is the standard deviation of my input sample. So, for the error bar, I would need the bar at the x axis value 31, with the error bar start at (second column value)-(third column value), and end at (second column value)+(third column value). I tried the following:

plot "file.txt" using ($1-$2):1:($2+$1) with errorbars

but the result is inappropriate. Any help?


回答1:


You need x:y:err, so try

plot "file.txt" using 1:2:3 with yerrorbars

You may instead want candlesticks. These are generally a box with error bars extending out of the top and bottom, but setting the mins and maxes the same should give you boxes of the required size:

plot "file.txt" using 1:($2-$3):($2-$3):($2+$3):($2+$3) with candlesticks




回答2:


you can also try:

plot "file.txt" using 1:2:($2-$3):($2+$3) with errorbars

($2-$3) is y error bar low value, and ($2+$3) is y error bar high value

However, I think that you should use standard error = standard deviation / square root (sample size), instead of standard deviation, to compute error bars.



来源:https://stackoverflow.com/questions/10684182/gnuplot-with-errorbars-plotting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!