1
votes

I am trying to plot histogram using "gnuplot". The code I used is as blow:

#!/usr/bin/gnuplot

###PNG
set terminal pngcairo size 650,550 enhanced dash font "arial,10" #fontscale 1.20
set output "hb-maltoLyo12per.png"

set macro
labelFONT="font 'Arial,23'"
scaleFONT="font 'Arial,18'"
scaleFONT2="font 'Arial,13'"


set boxwidth 0.75 absolute
set style fill solid 1.00 border -1
set style histogram rowstacked
set style data histograms

set xtic  rotate by -30  1000 nomirror  @scaleFONT2 offset character -1, 0, 0
set ytics 100 nomirror  @scaleFONT
set mxtics 2
set mytics 5
set ytics 2
set yrange [0:10]
set ylabel "Hydrogen Bond"  @labelFONT
set xlabel ''                      

plot 'data_average_HB.dat' using 2 t "Inter-moleculear HB", '' using 3:xticlabels(1) t "Lipid to Solvent HB" with histogram

Using the above code, I get a plot as I shown in histogram

The xtics labels (along x-axis) go hide below the graph. Each one is long phrase. I want them to appear to visible.

Is there anything missing in my code? How I can achieve this?

Many thanks in advance.

1

1 Answers

2
votes

Gnuplot isn't very good at estimating the margins for special tic label formattings (e.g. long rotated labels). You can use set bmargin to set the bottom margin manually.

Try using

set bmargin 4

which would use a bottom margin corresponding to 4 character heights of the choosen font. You'll proably need to adjust the 4 in your case.