Code for scatterplots and motionplots