On Sun, Jan 30, 2011 at 10:32 PM, Peter Butterworth <butt...@gmail.com> wrote: > When plotting interactively is it actually possible to update the > legend with the current plots while retaining the previous legend > settings (position, visibility, etc.) ? >
I think it is possible, but will be quite difficult to do for a normal user. I may try to add some method that can ease this. > here are some observations on the mpl legend operation: > leg = ax.get_legend() #0 OK. but the recommended way to update a > legend seems to be using #1 ? > leg = ax.legend() #1 OK > leg.draggable(True) #3 enables the legend to be moved with mouse. > New in mpl1.0.1. OK > leg.set_visible(False) #4 hides legend. OK > ax.legend(loc=3) #2 defines a legend location. OK but why no > locations outside the plotting area ? Legend can be located outside the plotting area, anywhere you want. http://matplotlib.sourceforge.net/users/legend_guide.html#legend-location > ax.legend(ax.lines) #5 labels are different by default from #1. ?? http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.legend If there is a single non-keyword argument, it is treated as a list of labels. > ax.legend([]) #6 draws an empty square. ?? To me, the current behavior seems reasonable. What do you expect? > leg._loc: #7 allows you to know the legend location. in > #2 value is int, in #3 value is a tuple (if the legend has been moved) > OK but why is the attribute private ? > I guess this is a valid point. I'll add a public interface to access this value. > What to exclude from a legend : > Objects without an explicit label (labels starting with _) #8. OK > Objects that are not in the viewing area #9. should be default > behavior ?? > Objects that are not set visible #10. should be default > behavior ?? For #9, I don't think there is an exact algorithm to check if a path is inside the viewing are or not when cubic splines are involved. If there is (and that algorithm is feasible), we may consider making that a default behavior. Otherwise, I'm not inclined to include a partial solution. For #10, I'll make it a default behavior if there is no objection. Regards, -JJ > > -- > thanks, > peter butterworth > > ------------------------------------------------------------------------------ > Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! > Finally, a world-class log management solution at an even better price-free! > Download using promo code Free_Logger_4_Dev2Dev. Offer expires > February 28th, so secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsight-sfd2d > _______________________________________________ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel