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

[ENH]: Remove artists from axes completely. #25168

Open
@komoto48g

Description

@komoto48g

Problem

Callingart.remove() doesn't seem to completely detach the art from the original axes.
In the following sample code, when removing the art from axes (sayax1) and adding it to other axes (sayax2), theax2 will not draw the art.

importnumpyasnpfrommatplotlibimportpatchesfrommatplotlibimportpyplotaspltdata=np.random.rand(5,5)fig=plt.figure()ax1,ax2=fig.subplots(1,2)ax1.imshow(data,interpolation='nearest',cmap='gray',)ax2.imshow(data,interpolation='bilinear',cmap='gray',)if1:art=patches.Circle((2,2),2,fill=0)ax1.add_artist(art)art.remove()ax2.add_artist(art)plt.show()

This issue was raised on:Discrouse matplotlib.

Proposed solution

The following line is suggested to be added after `art.remove()':

art.set_transform(ax2.transData)

or

art._transformSet = False

should be added in theart.remove method.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp