Search code examples
gnuplot

gnuplot: customize labels on bar plots


The following script make a bar graphs indicating the y values directly on the colored bars.

set term pngcairo size 1200,900
set title "$file_name" noenhanced font "Century,28" textcolor "#b8860b"
set xtics noenhanced font "Helvetica,10"
set xlabel "Residue, #"
set ylabel "dG, kKal/mol"
set yrange [-10:0]
set ytics 1.0
set grid y
set key off
set boxwidth 0.9
set style fill solid 0.5
plot \$data using 0:2:3:xtic(1) with boxes lc rgb var, \
        '' using 0:2:2 with labels offset 0,1

how could I additionally modify the text size and its color of the values corresponded to the Y-values in each bar ? enter image description here


Solution

  • Have you consulted help labels?

    For example something like this:

    set samples 11
    plot '+' u 1:1 w boxes, '+' u 1:1:1 w labels tc "red" font ",14"
    

    Not much different in your example:

    plot \$data using 0:2:3:xtic(1) with boxes lc rgb var, \
            '' using 0:2:2 with labels tc "red" font "Arial Bold,14" offset 0,1  
      # or whatever font you have available