2012-07-05 56 views
9

條形圖上添加錯誤吧,我有以下文件我想用gnuplot的條形圖繪製:在gnuplot的

Function X X-ERROR Y Y-ERROR 
A 1.311539 0.066268 1.000000 0.000000 
(a1,b0) 1.325429 0.083437 1.010926 0.016710 
(a.9,.b1) 1.134640 0.040017 1.276168 0.060281 
(a.8,.b2) 1.078336 0.058529 1.346358 0.054645 
(a.7,.b3) 1.035866 0.060660 1.318395 0.018087 
(a.6,.b4) 0.982717 0.047363 1.196714 0.047427 
(a.5,.b5) 0.962423 0.051994 1.127991 0.044731 
(a.4,.b6) 0.953673 0.046014 1.139608 0.044726 
(a.3,.b7) 0.948948 0.050462 1.169209 0.044333 
(a.2,.b8) 0.941013 0.047166 1.198138 0.045844 
(a.1,.b9) 0.929961 0.057801 1.328111 0.088813 
(a0,b1) 0.966331 0.036079 3.289381 0.213192 
B 1.000000 0.000000 3.321802 0.121290 

我可以管理完美繪製圖形使用:

plot 'file.dat' using 4:xtic(1) title col, \\ 
     '' using 2:xtic(1) title col; 

不過,我想用第3列和第5列來表示我總是計算的置信區間。任何幫助?

謝謝!

回答

12

假設你想畫並排側條形圖與相關聯的錯誤吧,我會用如下:

set xrange [-0.5:12.75] 
set xtic rotate by -45 
set boxwidth 0.25 
plot 'file.dat' using ($0-.05):4:5:xtic(1) with boxerrorbars title col, \\ 
    '' using ($0+0.25):2:3 with boxerrorbars title col 

這個想法只是爲了抵消在x軸上的兩個措施之一。

enter image description here

+0

這正是我想要的! Lemme真的很快測試! – Dynelight 2012-07-12 18:58:41

+1

($ 0-.05):4:5:xtic(1)中的'($ 0-.05)'代表什麼?我知道'4'正在告訴方框使用第4列。 '5'告訴錯誤欄使用第5列作爲錯誤欄的增量。 'xtic(1)'告訴gnuplot使用第一列作爲標籤。 – joseph 2015-09-30 23:15:11

0

我想這應該做你想做的(如果我正確理解你的陰謀......)

plot 'test.dat' using (column(0)):4:3:xtic(1) w errorbars title col, \ 
    '' using (column(0)):2:5:xtic(1) w errorbars title col; 
+0

嗨,感謝您的回覆!其實它不是那樣...我想要這樣的東西:http://www.csse.uwa.edu.au/programming/gnuplot_demos/errorbar/errorbar.html看看集標題「Boxerrorbars演示」..我有兩種不同類型的小節,每個小節都必須顯示。對於每個酒吧,錯誤欄=)這是否更清楚?我應該製作一個圖表,也許這會更具代表性? – Dynelight 2012-07-07 00:01:02