Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Axes.cla() with sharex may wrongly reset the axes limit. #27825

Open
@tianzhuqiao

Description

@tianzhuqiao

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.

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

image

Expected outcome

image

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp