analysis and plotting