Cleaned up python plot function.