#! /usr/bin/gnuplot -p

## TODO : use a variable / set title cmd to set title

set terminal pdfcairo font "Helvetica,12"  size 5in,5in
set output 'data.tmp.pdf'

#set title "results_I1_10:1/plat_grid64/topo_hcube"

#set key outside
set nokey

#set size square

set xtic rotate by -75 scale 0 left
set style data histograms
set style histogram rowstacked
set style fill solid border -1

set yrange [0:*]
set y2range [0:*]

set ytics nomirror
set y2tics

set ylabel 'Time (s)'
set y2label 'Data amount (relative)'

plot 'data.tmp' \
       using 4:xtic(1)                        title 'Idle duration', \
    '' using ($5 - $4)                        title 'Convergence time (avg)', \
    '' using ($6 - $5)                        title 'Convergence time (max)', \
    '' using 3 with linespoint pt 1 axes x1y2 title 'Data transfer amount'