added code for getting RDM and plotting