-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Labels
Milestone
Description
Bug summary
After making sexond axes on the righr with twinx y_label for this second axes is on the right, but clearing (doesn't matter is it cla() or clear()) second axes breaks set_ylabel putting it on the left. Ticks for second axes are still on the right, so I don't see why y_label wouldn't also go there (thats why I think its a bug)
Code for reproduction
import matplotlib
import matplotlib.pyplot as plt
figure = plt.figure()
ax = figure.add_subplot(111)
ax2 = ax.twinx()
ax2.cla()#or clear() ; doesn't work both ways
ax.set_ylabel('ax_label')
ax2.set_ylabel('ax2_label')#expected to be on the right
plt.show()Actual outcome
Expected outcome
after clearing ax2 is still on the right, I expected its label also to be on the right

Additional information
I saw that similar solved problems occurred with twinx()(it was something to do with mirroring), but I couldn't find solution for this specific situation
Operating system
No response
Matplotlib Version
3.7.1
Matplotlib Backend
No response
Python version
No response
Jupyter version
No response
Installation
None
Reactions are currently unavailable
