问题
I want to group an histogram rowstacked in gnuplot similar to this image:
I have these 2 files where the data from the histogram comes from:
#Round-robin
Input West-Virginia ChicagoI ChicagoII California
1500 28 25 28 19
3000 30 24 25 21
4500 28 28 25 19
6000 34 25 23 18
#Min-makespan
Input West-Virginia ChicagoI ChicagoII California
1500 34 20 30 17
3000 33 30 21 16
4500 31 23 38 9
6000 42 21 38 0
plot for [i=2:5] 'cloudusage-roundrobin.dat' using i:xtic(1), \
for [i=2:5] 'cloudusage-minmakespan.dat' using i:xtic(1)
1 - My plot instruction stack both histograms, instead of having them side-by-side. How I put them side-by-side, and also with the 2 xx labels ?
回答1:
You must use newhistogram to start a new histogram. In order to use the same linetype, you must give the second call to newhistogram the option lt 1:
reset
set style data histogram
set style histogram rowstacked title offset 0,-1
set bmargin 4
set boxwidth 0.9
set style fill solid border lt -1
set key autotitle columnheader horizontal
plot newhistogram 'Cluster 1', \
for [i=2:5] 'cloudusage-roundrobin.dat' using i:xtic(1),\
newhistogram 'Cluster 2' lt 1, \
for [i=2:5] 'cloudusage-minmakespan.dat' using i:xtic(1) notitle
Result with 4.6.4:
来源:https://stackoverflow.com/questions/23406222/put-histogram-side-by-side