Simulation analysis and plotting code.