calculate sums and create plots