Fixed in r8295. Axes.annotate was not setting the _remove_method attribute. Regards,
-JJ On Tue, May 4, 2010 at 3:15 PM, Ryan May <rma...@gmail.com> wrote: > On Tue, May 4, 2010 at 2:09 PM, KrishnaPribadi > <krishna.prib...@harley-davidson.com> wrote: >> I'm trying to remove or delete an annotate arrow but I'm unsuccessful. Can >> some please help? Thanks. >> >> I tried the [artist].remove() but that will not work with arrows or annotate >> objects... >> >> Here is some example code, please add in the code I need if you can: >> >> import numpy as np >> import matplotlib.pyplot as plt >> >> t = np.arange(0, np.pi*2, 0.01) >> x = np.sin(2*np.pi*t) >> fig = plt.figure() >> myplot = ax.plot(t, x, 'b') >> >> arrow = ax. annotate('my arrow', xy=(3, -0.5), xycoords='data', >> horizontalalignment='center', >> verticalalignment='center', >> color='red', alpha=0.5, >> xytext=(0, -2), textcoords='offset points', >> arrowprops=dict(facecolor='red', frac=0.4, >> shrink = 0.05, alpha=0.5, width=2, headwidth=5), >> ) >> >> #Code to remove arrow... >> # arrow.remove() #this does not work... >> >> plt.show() > > You can accomplish it by: > > ax.texts.remove(arrow) > > I'd still like to know why this exception gets raised: > > > NotImplementedError Traceback (most recent call last) > > /home/rmay/<ipython console> in <module>() > > /home/rmay/.local/lib/python2.6/site-packages/matplotlib/artist.pyc in > remove(self) > 123 self._remove_method(self) > 124 else: > --> 125 raise NotImplementedError('cannot remove artist') > 126 # TODO: the fix for the collections relim problem is to move > the > > 127 # limits calculation into the artist itself, including > the property > > > NotImplementedError: cannot remove artist > > JJ, thoughts? > > Ryan > > -- > Ryan May > Graduate Research Assistant > School of Meteorology > University of Oklahoma > > ------------------------------------------------------------------------------ > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users