On Sun, Sep 27, 2009 at 3:45 PM, Peter Butterworth <butt...@gmail.com> wrote: > On Sun, Sep 27, 2009 at 9:31 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote: >>> Some feedback: If plotting a line2D as discrete points rather than a >>> continuous line, you must use numpoints=2 for the legend picking to actually >>> occur on the points. The alpha blending doesn't work on the legend symbols >>> however. >>> >> >> I tried numpoints=1,2,3 but all worked for me. Can someone else confirm this? > > I'm using windows and mpl 0.99.0:
Most of the enhancements to support legend picking happened after 99.0 -- you probably need to be on svn trunk (I don't think 99.1 would work either). The example is working fine for me on svn HEAD (regardless of ncol) with one exception: if I use a marker instead of a line, the alpha is not respected (the line markers are simply turned off). Apparently we need to fix Line2D to respect the alpha setting for markers in this use case. JDH > > > >> The alpha for legend symbols does not work since, inside legend, the >> lines and symbols are drawn by different artists. >> >> Try something like below. >> >> >> legline.set_alpha(1.0) >> try: >> legline._legmarker.set_alpha(1.0) >> except AttributeError: >> pass >> >> >> >>> Is there any other way, I can show in the legend whether the points of the >>> series are visible or not ? >>> >>> I thought of changing the labels, but failed to get them to redraw. >>> >> >> Legend.get_texts() method returns the list of Text instances. >> >> http://matplotlib.sourceforge.net/api/artist_api.html?highlight=legend#matplotlib.legend.Legend.get_texts >> >> You may modify the returned Text instances. >> >> -JJ >> > > works great. > > > >> >>> # plots: >>> ax.plot(t, y1, 'ro', picker=5, label='lab1') >>> ax.plot(t, y2, 'bo', picker=5, label='lab2') >>> >>> # legend >>> leg = ax.legend(loc='upper left', numpoints=2, fancybox=True, shadow=True) >>> lines, labels = ax.get_legend_handles_labels() >>> >>> # Enable picking on the legend lines >>> leglines=leg.get_lines() >>> for legline in leglines: legline.set_picker(5) > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users