>> I believe (as of v1.3.1) that after you create the legend you call
>> leg.draggable(True)
>>
http://matplotlib.org/api/legend_api.html#matplotlib.legend.Legend.draggable
>
> Outstanding! (Google was not my friend here. I wasn't searching for
> "draggable.")

It works if I only plot using the left Y axis. If I add plots to the right
Y axis it won't drag. Basically, the code looks like this:

left_plot = figure.add_subplot(111)
... do left_plot stuff ...

if I have right axis data to plot:
    right_plot = left_plot.twinx()
    ... do right_plot stuff ...

if a legend is requested:
    labels = [line.get_label() for line in lines]
    left_plot.legend(lines, labels).draggable(True)

figure.tight_layout()
pylab.show()

The legend is displayed correctly. It has all the desired elements, but the
legend isn't mouse sensitive. This leads me to believe that the plotting
somehow makes mouse events get handled by the right Y axis subplot. If I
move the cursor around the plot, the Y coordinates displayed at the bottom
of the window are those of the left Y axis, however.

On that assumption, I tried changing the legend to be associated with the
right Y axis:

if a legend is requested:
    labels = [line.get_label() for line in lines]
    if I have right axis data to plot:
        right_plot.legend(lines, labels).draggable(True)
    else:
        left_plot.legend(lines, labels).draggable(True)

Again, the legend displays properly, but can't be dragged.

Any ideas?

Thx,

Skip
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to