modify for solving plot upside down problem