9951 explained code solutions for 126 technologies


python-matplotlibHow to invert Y axis


import matplotlib.pyplot as plt

plt.plot([2,1,3,5,3,3,4,5,2,1])
plt.gca().invert_yaxis()
plt.show()ctrl + c
import matplotlib.pyplot as plt

loads Matplotlib module to use plotting capabilities

.plot(

plot specified data

.gca()

returns current axes object

invert_yaxis()

inverts Y axis

.show()

render chart in a separate window