I should have read further in the code: things are done on a cumulative sum basis by layer, so the value for layer two is the sum of the metric for layer one and layer two – that’s why the lines stack so nicely. And after that summing there is a square root of the sum of sums of variances (at the point of plotting) so I guess that’s why they call it a standard deviation.
Also, the y axis labels seem to get misaligned somehow, so be careful trying to read values from the axis labels.

]]>