fitting and plotting