Below is the gnuplot code that creates clustered stacked histogram.
set terminal postscript eps enhanced 14
set datafile separator ";"
set output 'stacked_boxes.eps'
set auto x
set yrange [0:30]
set xtics 1
set style fill solid border -1
num_of_categories=2
set boxwidth 0.3/num_of_categories
dx=0.2
offset=-0.1
ddx=0.2
set key off
plot 'data.explorer0.csv' using ($1+offset):($3+$4) title "explorer0(sync)" linecolor rgb "#cc0000" with boxes, \
'' using ($1+offset):3 title "explorer0(wait)" linecolor rgb "#ff0000" with boxes, \
'data.explorer1.csv' using ($1+offset+dx):($3+$4) title "explorer1(sync)" linecolor rgb "#cc0000" with boxes, \
'' using ($1+offset+dx):3 title "explorer1(wait" linecolor rgb "#ff0000" with boxes, \
'data.collector0.csv' using ($1+dx+ddx):($3+$4) title "collector0(post)" linecolor rgb "#00cc00" with boxes, \
'' using ($1+dx+ddx):3 title "collector0(poll)" linecolor rgb "#00ff00" with boxes, \
'data.collector1.csv' using ($1+dx+ddx+dx):($3+$4) linecolor rgb "#00cc00" with boxes, \
'' using ($1+dx+ddx+dx):3 notitle linecolor rgb "#00ff00" with boxes here
How can I create labels for both per bar and per category? The four bars together make a category. Let the categories be (c0, c1, c2) and the bars per category be (e0, e1, c0, c1).
The plot can be reproduced using following data files:
data.explorer0.csv:
#level;explorerid;sync;wait;etc
"0";"e0";"2";"2"
"2";"e0";"4";"4"
"4";"e0";"6";"6"
data.explorer1.csv:
#level;explorerid;sync;wait;etc
"0";"e1";"7";"5"
"2";"e1";"6";"10"
"4";"e1";"5";"5"
data.collector0.csv:
#level;collectorid;sync;wait;etc
"0";"c0";"2";"2"
"2";"c0";"4";"4"
"4";"c0";"6";"6"
data.collector1.csv:
#level;collectorid;sync;wait;etc
"0";"c1";"5";"5"
"2";"c1";"8";"10"
"4";"c1";"9";"5"