Reputation:
gnuplot script:
set auto x
set yrange [0:100]
set style data histogram
set style histogram cluster gap 1
set style fill solid border -1
set boxwidth 1
plot 'test.data' using 1, '' u 2
test.data
80 15
71 81
81 71
61 75
57 17
80 80
82 91
86 73
output:
I need so:
How to reduce the gaps in the histogram gnuplot?
Upvotes: 3
Views: 5363
Reputation: 31
http://www.bersch.net/gnuplot-doc/histograms.html reports that you can use the "at x-coord" option with newhistogram in gnuplots to manually adjust the gap between clusters. I have used a combination of this, the "gap" option for set style histogram and "set offsets " command to move the clusters around on the graph. Hope this helps.
Upvotes: 1
Reputation: 48430
I think you cannot do this with the clustered histogram style, because the gap
option takes only integer numbers.
In your case with only two columns, you can use the boxes
plotting style and shift the boxes belonging to the first column by half of the boxwidth to the left, and the boxes of the second column by the same amount to the right:
set auto x
set yrange [0:100]
set style fill solid border -1
boxwidth=0.45
set boxwidth 0.45 absolute
set style data boxes
plot 'test.data' using ($0-boxwidth/2):1, '' u ($0+boxwidth/2):2
Result with 4.6.4:
Upvotes: 2
Reputation: 15930
You are looking for the gap
keyword to the set style histogram
command.
set style histogram clustered gap <width of gap>
Upvotes: -2