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
Description
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.