Here is a possible implementation with gnuplot (I'm not sure, if I interpreted the data_sim.txt columns correctly):
reset
set boxwidth 0.2 absolute
set style line 1 linecolor rgb '#5555CC' # for sim boxes
set style line 2 linecolor rgb '#BBBBff' # for exp boxes
set style line 3 linecolor rgb '#AE1100' lw 3 # for worst case
set style line 4 linecolor rgb '#6EB043' lw 3 # for best case
set style line 5 linecolor rgb 'black' # for medians
set style data candlesticks
plot 'data_ana.txt' using 0:2:(0.3):(0.001):xtic(stringcolumn(1)[16:*]) with boxxyerrorbars ls 4 title 'best case',\
'' using 0:3:(0.3):(0.001) with boxxyerrorbars ls 3 title 'worst case',\
'data_sim.txt' using ($0-0.2):3:2:6:5 whiskerbars ls 1 title 'simulation',\
'' using ($0-0.2):4:4:4:4 ls 5 notitle,\
'data_exp.txt' using ($0+0.2):2:2:4:4 ls 2 title 'experiment',\
'' using ($0+0.2):3:3:3:3 ls 5 notitle
with the result (using 4.6.3):
Some remarks to the code:
The boxes are plotted like How to combine two box-whisker plots into one using gnuplot, the medians must be added separately.
Each "block" is positioned using the row number (column(0), or $0). So the difference between two lines is 1, which is used to estimate the boxwidth and the shifted positions of the simulation and experimental data.
The xticlabels are positioned together with the "worst case" bars, because most of the other boxes or bars are shifted to the left or to the right.
To use the complete entry of the first column as xticlabels, use
xtic(1)
, which is a shortcut forxticlabel(stringcolumn(1))
. In that case you should also useset xtic rotate
to have the labels typeset vertically.