Search code examples
bar-chartgnuplot

How can I make a bar graph displaying y-min and y-max data along with custom colors for each bar?


I would like to make a bar graph that displays each bar as the bottom of the bar being y-min and the top of the bar being y-max. In addition I'd like each bar to have its own color fill and custom tics where xtic(1). Thank you

Similar to this below:

How to make range bar graphs in gnuplot?

ex.

#number #y-min #y-max #rgb
1        2      5      1
2        2.5    5.4    2
3        4      6      3
4        4.3    7      4

Solution

  • Here is what I ended up doing in case someone else needs it

    set termoption font ",22"
    boxwidth = 0.5
    set style fill solid
    set xtics nomirror
    set ytics nomirror
    set xtics font "{/:Bold,22}"
    set ytics font "{/:Bold,22}"
    set xlabel "Structure"
    set xlabel  font "{/:Bold,30}"
    set ylabel "Potential (V vs. RHE)"
    set ylabel  font "{/:Bold,30}"
    set xrange [-1:4.5]
    set yrange [0:7]
    set arrow from -1,2.5 to 4.5,2.5 nohead lc rgb 'black' dt 3
    plot 'poten-range-plot' u 0:(($2+$3)/2.):(boxwidth/2.):(($3-$2)/2.):4:xtic(1) w boxxyerrorbars notitle lw 3 lc variable, 1/0 t "Pt (111)" lt 1 lc rgb 'black'