substantial updates to the nested barplot: the legend is now drawn outside the plot and split into as many sections as there are bars, the colours are selected by RColorBrewer and a fall back to rainbow