Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Open
Labels
Milestone
Description
Bug summary
For example, when subplot A shares the x-axis with subplot B (A is created with sharex=B), a call toB.cla()
will set the xlimit to [0, 1], which may not be expected (in contrast, a call toA.cla()
will not change the xlimit).
I think the main problem comes from the following function, where it will check whether its_sharex
attribute isNone
; however, in this case, B is shared to A, but no axis is shared to B, so B's_sharex
attribute isNone
.
matplotlib/lib/matplotlib/axes/_base.py
Line 1369 in9e18a34
ifshareisnotNone: |
Code for reproduction
ax=plt.subplot(211)ax2=plt.subplot(212,sharex=ax)ax.plot(range(50))ax2.plot(range(50))ax.cla()plt.show()
Actual outcome
Expected outcome
Additional information
No response
Operating system
No response
Matplotlib Version
3.8.3
Matplotlib Backend
'TkAgg'
Python version
3.9.13
Jupyter version
No response
Installation
pip