updated python plotting code