Gnuplot Histogram w/ Error Bars

2019-07-20 04:06发布

问题:

I'm trying to make a bar chart /histogram with Gnuplot but I cant seem to get the error bars to come out.

This is my code:

set style data errorbars 
set style histogram errorbars gap 2 lw 1
set style data histograms
plot "ctcf.dat" using 2:3:3:xtic(1)

and data:

 #Label  Mean        Error
 168-B  24778.23544 33467.8754
 168-S  34067.82997 35542.62473
 168-B  22519.51553 30835.37332
 168-S  112976.1825 143760.3467

But they come out wrong:

What am I doing wrong?

回答1:

When plotting histograms with errorbars you need to give only two columns in the using statement. The first column gives the box height, the second one is ±<error>:

set style histogram errorbars gap 1 lw 1
set style data histograms
plot "ctcf.dat" using 2:3:xtic(1)