Is there a way to both reverse the y-axis with PyPlot
and make it logarithmic? I know that one of the two options can be done with
plt.gca().invert_yaxis()
and
plt.yscale('log')
However, the combination does not work. Any ideas? Thanks a lot!
By using the plt. gca() method we get the current axes of the plot. Then we use the invert_yaxis() method to flip the y-axis of the plot.
matplotlib.pyplot.clf() Function. The clf() function in pyplot module of matplotlib library is used to clear the current figure.
The best way to do this is simply to use this in the following order:
plt.scatter(x, y)
plt.yscale('log')
plt.gca().invert_yaxis()
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With