legend and bbox_to_anchor, and draggable()

I was playing around with draggable legends, and some strange things started happening (exception down in the depths of beckend_agg.py, accompanied by a long stack trace). To make a long story short, I can reproduce this in the draggable_legend.py example on the matplotlib website. All you have to do is change line 7 from

l = ax.legend()

to

l = ax.legend(bbox_to_anchor=(.1,.1))

Fire this up, and move the legend box with your mouse. It works. Move again, exception raised.

I’m sure that I’m not understanding the proper usage of bbox_to_anchor. I thought that i could use it to place the legend initially, and then let the user drag the legend around if the placement wasn’t satisfactory.

···


Daniel Hyams
dhyams@…287…