chevron_left
Axes Cookbook
1
0
0
new
Inverting y-axis in Matplotlib
Programming
chevron_rightPython
chevron_rightMatplotlib
chevron_rightCookbooks
chevron_rightAxes Cookbook
schedule Mar 9, 2022
Last updated Python●Matplotlib
Tags tocTable of Contents
expand_more To invert the y-axis in Matplotlib use the invert_yaxis()
method:
plt.plot([1,2,3])plt.gca().invert_yaxis()plt.show()
The output is as follows:

Notice how the y-axis is inverted; the upper bound is at the bottom, while the lower bound is at the top.
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
Ask a question or leave a feedback...