To set the xtic labels, you can use using 2:xtic(1)
in the very first command. To see the labels properly you must set the alignment of the xtics to right
.
And you can include the conversion command to rotate the plot inside the script. Call it with system
. You must use set output
without filename before that to indicate, that the file must be flushed and closed.
The changed script is:
reset
set terminal pngcairo size 500,500 enhanced font 'Verdana,10'
set output 'Err_rev.png'
set key at graph 0.24, 0.80 horizontal samplen 0.1
set style data histogram
set style histogram cluster gap 2
set style fill solid border -1
set boxwidth 0.8
set xtic rotate by 90 scale 0 right
unset ytics
set y2tics center rotate by 90
set yrange [0:100]; set xrange [*:*]
set y2label 'Paragone tra Nazioni: Domicilio - Hospice ' offset -2.5
set size 1, 0.96
set label 1 'Nazioni' at graph 0.5, char 1 centre rotate by 180
set label 2 'Domicilio' at graph 0.135, 0.83 left rotate by 90
set label 3 'Hospice' at graph 0.21, 0.83 left rotate by 90
plot 'dati.dat' u 2:xtic(1) title ' ', '' u ($2/2.0+rand(0)/10.0) title ' '
set output
# this command to modify the orientation of the png
system('convert -rotate 90 Err_rev.png Err_rev_out.png')
with the result Err_rev_out.png
(with version 4.6.3):
An alternative way to plot horizontal histograms is with the boxxyerrorbars
style, which also requires some, but other tricks. Gnuplot interchanging Axes