问题
I have gnuplot script like this:
set term pos eps
set style data histogram
set style histogram clustered gap 1
set grid y
set boxwidth 0.8 absolute
set style fill transparent solid 0.8 noborder
#set key outside right top vertical Left
#component stuff
set output 'eps/component.eps'
set title "Component in interesting Issues"
set xlabel "Components"
set xtics nomirror rotate by -270
plot 'dat/!component' using 2:xtic(1) t "Count" lc rgbcolor "blue" lt 1
and data:
Cmp count
AM 167
NM 90
RM 83
JT 53
TT 51
RED 32
MAP 29
COMM 3
SX 6
HS 68
and this is my output:

I see my graph has long spaces between the Y axis and the first bar. How can I spread the bars out evenly?
回答1:
gnuplot
gets confused by the first line in your data file, which is supposed to be the header. Just skip this line with every ::1
and the autoscaling is fine:
plot 'dat/!component' using 2:xtic(1) every ::1 t "Count" lc rgbcolor "blue" lt 1
Result with 4.6.4:

In general you don't need to use histograms for this kind of data, the plotting style with boxes
also works fine.
来源:https://stackoverflow.com/questions/23489449/space-between-y-axis-and-bar-on-gnuplot-histogram