add groupby and plotting