[Matplotlib-users] legend bug?
hi all, following my last post, i found what seems to me to be a bug in the legend handling of scatter plots. suppose i have: scatter([1,2,3],[1,2,3], label=_nolegend_) i then want to color some subset of these points in a different color, or plot them using a different marker size, etc. so i do: scatter([1],[1],c='r') then if i do: legend('my point', numpoints=1) the legend is still displayed with 3 points... even if i directly set rcParams['legend.numpoints'] = 1, it still behaves this way. any idea how to fix this? thank you -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] legend bug?
It can be tricky to give you a correct answer without knowing what version of mpl you're using. The legend for the scatter plot has been added rather recently so my answer below may not work for you. Anyhow, this seems to be a bug in the documentation, not the code. The legend for scatter plot has its own properties to control the number of points, which is scatterpoints. So, try legend(scatterpoints=1) As a side note, legend('my point', numpoints=1) The first argument should be a list, but I guess this could be just a typo. scatter([1,2,3],[1,2,3], label=_nolegend_) You'd better not use this (setting the label) if you're explicitly giving the legend labels. I recommend you to stick with either scatter([1,2,3],[1,2,3], label=_nolegend_) scatter([1],[1],c='r', label=mypoints) legend(scatterpoints=1) or s1=scatter([1,2,3],[1,2,3]) s2=scatter([1],[1],c='r') legend([s2], [mypoints], scatterpoints=1) -JJ On Wed, Mar 11, 2009 at 6:39 PM, per freem perfr...@gmail.com wrote: hi all, following my last post, i found what seems to me to be a bug in the legend handling of scatter plots. suppose i have: scatter([1,2,3],[1,2,3], label=_nolegend_) i then want to color some subset of these points in a different color, or plot them using a different marker size, etc. so i do: scatter([1],[1],c='r') then if i do: legend('my point', numpoints=1) the legend is still displayed with 3 points... even if i directly set rcParams['legend.numpoints'] = 1, it still behaves this way. any idea how to fix this? thank you -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are powering Web 2.0 with engaging, cross-platform capabilities. Quickly and easily build your RIAs with Flex Builder, the Eclipse(TM)based development software that enables intelligent coding and step-through debugging. Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Legend Bug in Pie chart with shadow=True
1.please compare figure 1 and figure 2 2 How to change text color on Pie chart ? (If fragment of Pie chart is black text is unreadable ) 3. Text 0.5% in figure 2 is unreadable, how correct this? ( i try use pctdistance= 1.1 but if value is format autopct='%1.4f%%' some text is unreadable ) #!/usr/bin/env python from pylab import * # make a square figure and axes figure(1, figsize=(8,8)) ax = axes([0.1, 0.1, 0.8, 0.8]) labels = 'Frogs', 'Hogs', 'Dogs', 'Logs' fracs = [50,25,24.5, 0.5] figure(1) pie(fracs, labels=labels) legend( loc='best', shadow=True) # figure(2) show a some optional features. autopct is used to label # the percentage of the pie, and can be a format string or a function # which takes a percentage and returns a string. explode is a # len(fracs) sequence which gives the fraction of the radius to # offset that slice. figure(2, figsize=(8,8)) explode=(0, 0.05, 0, 0) pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True) legend( loc='best', shadow=True) savefig('pie_demo') show() - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Legend bug with patches?
Scott == Scott Ransom [EMAIL PROTECTED] writes: Scott Hi All, I think I might have uncovered a bug in the legend Scott code when using multiple patches so that only the first Scott patch type is used in the legend. Scott In [41]: matplotlib.__version__ Out[41]: '0.87.5' Scott (that is revision 2782 from SVN) Scott Here is some code that shows the problem: Scott -- from pylab import * Scott binctrs = linspace(-4.0, 4.0, 15) vals = randn(1000) n1, Scott bins1, p1 = hist(vals, binctrs, align='center') n2, bins2, Scott p2 = hist(vals[:300], binctrs, align='center') setp(p1, Scott 'facecolor', 'k', 'alpha', 0.2) setp(p2, 'facecolor', 'g', Scott 'alpha', 0.9) legend((p1, p2), (Frobs, NewFrobs)) Scott show() -- The returned patches is a list of patches -- you just need to pick off a representative one ax = subplot(111) binctrs = linspace(-4.0, 4.0, 15) vals = randn(1000) n1, bins1, p1 = hist(vals, binctrs, align='center', facecolor='black', alpha=0.2) n2, bins2, p2 = hist(vals[:300], binctrs, align='center', facecolor='green', alpha=0.9) legend((p1[0], p2[0]), (Frobs, NewFrobs)) show() - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Legend bug with patches?
Hi All, I think I might have uncovered a bug in the legend code when using multiple patches so that only the first patch type is used in the legend. In [41]: matplotlib.__version__ Out[41]: '0.87.5' (that is revision 2782 from SVN) Here is some code that shows the problem: -- from pylab import * binctrs = linspace(-4.0, 4.0, 15) vals = randn(1000) n1, bins1, p1 = hist(vals, binctrs, align='center') n2, bins2, p2 = hist(vals[:300], binctrs, align='center') setp(p1, 'facecolor', 'k', 'alpha', 0.2) setp(p2, 'facecolor', 'g', 'alpha', 0.9) legend((p1, p2), (Frobs, NewFrobs)) show() -- Thanks, Scott -- Scott M. RansomAddress: NRAO Phone: (434) 296-0320 520 Edgemont Rd. email: [EMAIL PROTECTED] Charlottesville, VA 22903 USA GPG Fingerprint: 06A9 9553 78BE 16DB 407B FFCA 9BFA B6FF FFD3 2989 - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users