def onRemove(self, ev):
def sort_artists(artists):<EOL><INDENT>L = [ (h.zorder, h) for h in artists ]<EOL>L.sort()<EOL>return [ h for zorder, h in L ]<EOL><DEDENT>under = sort_artists(self.figure.hitlist(ev))<EOL>h = None<EOL>if under: h = under[-<NUM_LIT:1>]<EOL>while h:<EOL><INDENT>print("<STR_LIT>",h)<EOL>if h.remove():<EOL><INDENT>self.draw_idle()<EOL>break<EOL><DEDENT>parent = None<EOL>for p in under:<EOL><INDENT>if h in p.get_children():<EOL><INDENT>parent = p<EOL>break<EOL><DEDENT><DEDENT>h = parent<EOL><DEDENT>
Mouse event processor which removes the top artist
under the cursor.  Connect this to the 'mouse_press_event'
using::

    canvas.mpl_connect('mouse_press_event',canvas.onRemove)