cleaned up python code to use their plotting function