python - Flip a plot in matplotlib -


i creating plot matplotlib

import numpy np import matplotlib.pyplot plt  x = np.arange(0, 5, 0.1); y = np.sin(x) plt.plot(x, y) 

can flip plot, making y-axis inverted , positive values negative , vice versa?

i know can multiply -1 , use invert_yaxis wonder if there function flipping without changing values.

try following function:

plt.gca().invert_yaxis()