You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Calling invert_yaxis() on a 3D plot has either no effect or removes ticks #14577
Using version 3.1.0, ax.invert_yaxis() does not work as expected when called on a 3D scatter plot. There seems to be no effect when it is called after populating the plot, while calling it before the plot inverts the data points correctly but moves all ticks to one point.
Code for reproduction
# Version 1: calling invert_yaxis() after populating the plot.# Version 2 (omitted): calling invert_yaxis() after ax = fig.add_subplot(111, projection='3d')# Using the official 3D scatter plot example. frommpl_toolkits.mplot3dimportAxes3Dimportmatplotlib.pyplotaspltimportnumpyasnpnp.random.seed(19680801)
defrandrange(n, vmin, vmax):
''' Helper function to make an array of random numbers having shape (n, ) with each number distributed Uniform(vmin, vmax). '''return (vmax-vmin)*np.random.rand(n) +vminfig=plt.figure()
ax=fig.add_subplot(111, projection='3d')
n=100# For each set of style and range settings, plot n random points in the box# defined by x in [23, 32], y in [0, 100], z in [zlow, zhigh].form, zlow, zhighin [('o', -50, -25), ('^', -30, -5)]:
xs=randrange(n, 23, 32)
ys=randrange(n, 0, 100)
zs=randrange(n, zlow, zhigh)
ax.scatter(xs, ys, zs, marker=m)
ax.invert_yaxis()
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.show()
Actual outcome when inverting axis after populating plot:
Actual outcome when inverting axis before populating plot:
@qizidog I think this ticket is old enough and has been closed long enough that your comment is unlikely to get noticed acted upon. @baloe created a new ticket (#21843) and that closed as duplicate of #21369. So please follow up there, if it makes sense, or open a new ticket.
Activity
ImportanceOfBeingErnest commentedon Jun 19, 2019
Bisects to #13330 (No surprise, a feature was added without tests!)
A slightly better test case
Actual output
First plotting, then inverting the axes (left) just does nothing. First inverting, then plotting (right) scrambles the ticks.
Expected output
same as in matplotlib 3.0.2:
baloe commentedon Dec 2, 2021
Still not the expected output for me:

qizidog commentedon Jan 4, 2022
The same code output in macos m1. There is still a fatal problem.
ivanov commentedon Jan 5, 2022
@qizidog I think this ticket is old enough and has been closed long enough that your comment is unlikely to get noticed acted upon. @baloe created a new ticket (#21843) and that closed as duplicate of #21369. So please follow up there, if it makes sense, or open a new ticket.
HabibSlim commentedon Nov 7, 2022
This issue still exists in
3.2.2. I'm aware that it might be non-trivial to fix but it's a pretty big bugjklymak commentedon Nov 7, 2022
This was supposed to have been fixed in 3.6.0. If it is not fixed please open a new issue with required information.