new version
code for plotting