Re: [matplotlib-devel] Number of points in legend
On Tue, Jun 24, 2008 at 1:57 AM, Stéfan van der Walt <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> Sorry to bump the thread, but has anyone had a chance to take a look?
>
> I've re-attached the patch.
Thanks for the reminder and sorry for the delay getting back. The
problem in the patch was that the "self.texts" variable and
"self.legendHandles" variables are assumed to be equal length lists.
When you added an extra marker line but not an extra label, the layout
got out of whack, but this was masked in "_update_positions" by a
silent zip failure. I replaced that call with our cbook.safezip
function, which will at least fail noisily if the input lists are
unequal (note to all mpl devels, use safezip rather than zip).
The solution was not to modify the legendHandles return list "ret" at
all, since tracking that through all the hairy legend code proved
untenable. Instead, I made the code a little hairier by tacking on
your marker proxy as an attribute of the legend line::
legline_marker = Line2D(xdata_marker, ydata[:len(xdata_marker)])
legline_marker.update_from(handle)
legline_marker.set_linestyle('None')
self._set_artist_props(legline_marker)
# we don't want to add this to the return list because
# the texts and handles are assumed to be in one to ne
# correpondence.
legline._legmarker = legline_marker
and then accessing the "_legmarker" attr in _update_positions and
draw. Note you can use the marker 'None' rather than setting the
markersize to 0; we use the string 'None' for the marker and linestyle
since None means "do the rc default" in many contexts.
Committed to svn r5654 -- here is the test script::
import numpy as np
import matplotlib.pyplot as plt
plt.plot(np.random.rand(10), 'x-', label='first line')
plt.plot(np.random.rand(10), 'o-.', label='second line')
plt.legend(numpoints=1)
plt.show()
At some point we need to do a clean room impl of the legend code as it
is suffering from feature creep and the internals are getting uglier.
JDH
-
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] matplotlib hangs
Hi all, Since *yesterday* I have some trouble with pylab. Some program hang. I cannot use Ctrl C to kill them. Ctrl Z works. If I use ps I get 1091 pts/500:00:02 python 1119 pts/500:00:00 gs gs is somehow connected to my problem. I can kill the job by kill -9 1091. Then the gs process (1119) also vanishes. Any pointer ? I am using svn from trunk. Nils - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] matplotlib hangs
On Tuesday 24 June 2008 09:22:34 am Nils Wagner wrote: > Hi all, > > Since *yesterday* I have some trouble with pylab. > Some program hang. I cannot use Ctrl C to kill them. > Ctrl Z works. If I use ps I get > > 1091 pts/500:00:02 python > 1119 pts/500:00:00 gs > > gs is somehow connected to my problem. > > I can kill the job by kill -9 1091. Then the gs process > (1119) also vanishes. > > Any pointer ? > I am using svn from trunk. Help us help you. Give us something to go on. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] matplotlib hangs
On Tue, Jun 24, 2008 at 8:35 AM, Darren Dale <[EMAIL PROTECTED]> wrote: > On Tuesday 24 June 2008 09:22:34 am Nils Wagner wrote: >> Hi all, >> >> Since *yesterday* I have some trouble with pylab. >> Some program hang. I cannot use Ctrl C to kill them. >> Ctrl Z works. If I use ps I get >> >> 1091 pts/500:00:02 python >> 1119 pts/500:00:00 gs >> >> gs is somehow connected to my problem. >> >> I can kill the job by kill -9 1091. Then the gs process >> (1119) also vanishes. >> >> Any pointer ? >> I am using svn from trunk. > > Help us help you. Give us something to go on. My fault -- I was working on adding an idle event handler across backends and implemented something using threads for tkagg and haven't solved the problem of cross thread signal handling. I've commented out the functionality for now until I get it fixed (svn r5655). But yes, Nils, at a minimum, the OS, backend, and svn revision number need to be included in bug reports. Thanks for the report, JDH - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] matplotlib hangs
On Tue, 24 Jun 2008 08:59:30 -0500 "John Hunter" <[EMAIL PROTECTED]> wrote: > On Tue, Jun 24, 2008 at 8:35 AM, Darren Dale ><[EMAIL PROTECTED]> wrote: >> On Tuesday 24 June 2008 09:22:34 am Nils Wagner wrote: >>> Hi all, >>> >>> Since *yesterday* I have some trouble with pylab. >>> Some program hang. I cannot use Ctrl C to kill them. >>> Ctrl Z works. If I use ps I get >>> >>> 1091 pts/500:00:02 python >>> 1119 pts/500:00:00 gs >>> >>> gs is somehow connected to my problem. >>> >>> I can kill the job by kill -9 1091. Then the gs process >>> (1119) also vanishes. >>> >>> Any pointer ? >>> I am using svn from trunk. >> >> Help us help you. Give us something to go on. > > My fault -- I was working on adding an idle event >handler across > backends and implemented something using threads for >tkagg and haven't > solved the problem of cross thread signal handling. > I've commented > out the functionality for now until I get it fixed (svn >r5655). But > yes, Nils, at a minimum, the OS, backend, and svn >revision number need > to be included in bug reports. > > Thanks for the report, > JDH > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > ___ > Matplotlib-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel Hi John, hi Daren, Thank you for your prompt reply and sorry for my rudimental bug report. BTW, is the transparency option for png files in progress ? Cheers, Nils - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] matplotlib hangs
On Tue, Jun 24, 2008 at 9:17 AM, Nils Wagner <[EMAIL PROTECTED]> wrote: > Thank you for your prompt reply and sorry for my rudimental bug report. > > BTW, is the transparency option for png files in progress ? I believe the unspoken consensus was it is easy to set the alpha on the figurePatch and axesPatch so a global alpha was unneccessary. Typically one wants the background to be translucent, but not every figure element. If there is a use case where one wants *every* figure element to be translucent with the same alpha, we can reconsider. For PNGs however, postprocessing the alpha is easy, and one can do this in mpl. JDH - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] PNG transparency
Nils, I saw your bump about this transparency issue. Before moving forward on this, I'd like to know what your use case is. I've attached a mock-up example. On the left is the effect of changing the alpha value of everything to 50% (what you and Christopher had suggested). But it seems to me what you really want is on the right -- making only the figure and axes patch fully-transparent. This is what one would want, for example, when putting a plot on the colored background of a webpage. I don't understand why anyone would want the one on the left, but if you can provide a use case for it, it should be implementable. Cheers, Mike Michael Droettboom wrote: Of course, this depends on what you mean by transparency. If you mean to change the alpha of the entire PNG, then yes, the global parameter (or postprocessing) is the way to go. But I'm not sure how useful that is -- that will still lighten things behind the figure and axes patch. A more useful option, IMHO, would be to just make the figure patch and axes patch fully transparent and leave everything else "as is". That avoids the "white box on a colored background" problem. Cheers, Mike Christopher Barker wrote: Nils Wagner wrote: "John Hunter" <[EMAIL PROTECTED]> wrote: I wonder if we should support a global rc alpha I'd make it an optional parameter to savefig(), but I like the idea. Of course one could pretty easily post-process it as well. -CHB -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA <>- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] PNG transparency
John wrote: "I believe the unspoken consensus was it is easy to set the alpha on the figurePatch and axesPatch so a global alpha was unneccessary." It still might be convenient to make this an option on savefig. Sure it's only a few lines of code, but not necessarily obvious lines of code. Waiting to hear back from Nils as to whether this is really what he wants, though. Cheers, Mike Michael Droettboom wrote: > Nils, > > I saw your bump about this transparency issue. Before moving forward > on this, I'd like to know what your use case is. I've attached a > mock-up example. On the left is the effect of changing the alpha > value of everything to 50% (what you and Christopher had suggested). > But it seems to me what you really want is on the right -- making only > the figure and axes patch fully-transparent. This is what one would > want, for example, when putting a plot on the colored background of a > webpage. I don't understand why anyone would want the one on the > left, but if you can provide a use case for it, it should be > implementable. > > Cheers, > Mike > > Michael Droettboom wrote: >> Of course, this depends on what you mean by transparency. If you >> mean to change the alpha of the entire PNG, then yes, the global >> parameter (or postprocessing) is the way to go. But I'm not sure how >> useful that is -- that will still lighten things behind the figure >> and axes patch. >> A more useful option, IMHO, would be to just make the figure patch >> and axes patch fully transparent and leave everything else "as is". >> That avoids the "white box on a colored background" problem. >> >> Cheers, >> Mike >> >> Christopher Barker wrote: >> >>> Nils Wagner wrote: >>> "John Hunter" <[EMAIL PROTECTED]> wrote: > I wonder if we should support a global rc alpha > >>> I'd make it an optional parameter to savefig(), but I like the idea. >>> >>> Of course one could pretty easily post-process it as well. >>> >>> -CHB >>> >>> >>> >> >> > > > > > > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > > > ___ > Matplotlib-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] upcoming release
"Sandro Tosi" <[EMAIL PROTECTED]> writes: > On Mon, Jun 23, 2008 at 13:48, Sandro Tosi <[EMAIL PROTECTED]> wrote: > > On Mon, Jun 23, 2008 at 04:43, Charles Moad <[EMAIL PROTECTED]> wrote: > >> The releases and builds are up. Please test them out, and I'll leave the > >> announcements to you, John. > > > > I just downloaded it (MD5Sum: 1f673f82eb4f7422c1e45545f8e083d4) and I > > plan to upgrade the package in Debian this evening. > > mpl 0.98.1 has just been uploaded in unstable (tomorrow will be > available on debian mirrors hosts). I've installed this (in a chroot). All the wx examples I've tried seem fail at the line: from wx import * eg: [EMAIL PROTECTED]:/usr/share/doc/python-matplotlib-doc/examples/user_interfaces$ ./embedding_in_wx.py Traceback (most recent call last): File "./embedding_in_wx.py", line 45, in from wx import * AttributeError: 'module' object has no attribute '__DocFilter' This must be a bug in the Debian package providing wx (which I ought to report). Is it good practice though? > Thanks for the support, Indeed - and thanks for packaging it so rapidly. Chris - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] matplotlib hangs
On Tue, Jun 24, 2008 at 6:59 AM, John Hunter <[EMAIL PROTECTED]> wrote: > My fault -- I was working on adding an idle event handler across > backends and implemented something using threads for tkagg and haven't > solved the problem of cross thread signal handling. That's a nasty problem. See http://sebulba.wikispaces.com/recipe+thread2 for info, and IPython implements that trick in Shell.py, look for HAS_CTYPES in there and see the signal handlers that are in that section. It's never 100% reliable, but the addition of this trick did help a lot for -pylab. I don't know if it will do the trick for you. Cheers, f - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Feature request for a watermark function
Hi All, This is to let you know that I have filed a feature request for a watermark function in mpl. http://sourceforge.net/tracker/index.php?func=detail&atid=560721&aid=2001940&group_id=80706 Nils - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Feature request for a watermark function
There are a couple of different ways this could be done. Alpha-blending over top of the image (should work for everything but Postscript): gcf().text(0.1, 0.1, "Watermark", rotation=45, fontproperties=FontProperties(size=64), alpha=0.2) Or under the axes as described here: http://www.mail-archive.com/[EMAIL PROTECTED]/msg06036.html The fiddly bits are just scaling it in such a way to fit. Patches welcome... ;) Cheers, Mike Nils Wagner wrote: > Hi All, > > This is to let you know that I have filed a feature > request for a watermark function in mpl. > > http://sourceforge.net/tracker/index.php?func=detail&atid=560721&aid=2001940&group_id=80706 > > Nils > > - > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > ___ > Matplotlib-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > -- Michael Droettboom Science Software Branch Operations and Engineering Division Space Telescope Science Institute Operated by AURA for NASA - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Feature request for a watermark function
On Tue, Jun 24, 2008 at 1:10 PM, Michael Droettboom <[EMAIL PROTECTED]> wrote: > There are a couple of different ways this could be done. > > Alpha-blending over top of the image (should work for everything but > Postscript): > > gcf().text(0.1, 0.1, "Watermark", rotation=45, > fontproperties=FontProperties(size=64), alpha=0.2) > > > Or under the axes as described here: > > http://www.mail-archive.com/[EMAIL PROTECTED]/msg06036.html > > The fiddly bits are just scaling it in such a way to fit. One could use the adaptive approach I posted previously for subplots_adjust -- connect to the draw event and recursively scale the fontsize until is mostly covers the canvas http://matplotlib.sourceforge.net/doc/html/faq/howto_faq.html#how-do-i-automatically-make-room-for-my-tick-labels One could also use figimage for this if you want to watermark with a PNG or JPG, but right now figure artists don't respect zorder so some minor work would need to be done to get the watermark on top. JDH - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Feature request for a watermark function
On Tue, 24 Jun 2008 14:10:08 -0400 Michael Droettboom <[EMAIL PROTECTED]> wrote: > There are a couple of different ways this could be done. > > Alpha-blending over top of the image (should work for >everything but Postscript): > > gcf().text(0.1, 0.1, "Watermark", rotation=45, >fontproperties=FontProperties(size=64), alpha=0.2) > > > Or under the axes as described here: > > http://www.mail-archive.com/[EMAIL PROTECTED]/msg06036.html > > The fiddly bits are just scaling it in such a way to >fit. > > Patches welcome... ;) > > Cheers, > Mike Actually, I would like to display an image (png format) 'under' several lines. Assuming that a watermark function will be supported by mpl, it would be nice to have an example in matplotlib/examples/pylab_examples Nils - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Feature request for a watermark function
On Tue, Jun 24, 2008 at 1:27 PM, Nils Wagner <[EMAIL PROTECTED]> wrote: > Actually, I would like to display an image (png format) > 'under' several lines. > Assuming that a watermark function will be supported by > mpl, it would be nice to have an example in > > matplotlib/examples/pylab_examples [EMAIL PROTECTED]:examples> svn commit -m 'added simple watermark examples' Adding examples/api/watermark_image.py Adding examples/api/watermark_text.py Adding (bin) examples/data/logo2.png Transmitting file data ... Committed revision 5669. - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Feature request for a watermark function
On Tue, 24 Jun 2008 14:03:33 -0500 "John Hunter" <[EMAIL PROTECTED]> wrote: > On Tue, Jun 24, 2008 at 1:27 PM, Nils Wagner > <[EMAIL PROTECTED]> wrote: > >> Actually, I would like to display an image (png format) >> 'under' several lines. >> Assuming that a watermark function will be supported by >> mpl, it would be nice to have an example in >> >> matplotlib/examples/pylab_examples > > [EMAIL PROTECTED]:examples> svn commit -m 'added simple >watermark examples' > Adding examples/api/watermark_image.py > Adding examples/api/watermark_text.py > Adding (bin) examples/data/logo2.png > Transmitting file data ... > Committed revision 5669. Great ! Thank you very much !! Nils - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Number of points in legend
2008/6/24 John Hunter <[EMAIL PROTECTED]>: > Committed to svn r5654 -- here is the test script:: > > import numpy as np > import matplotlib.pyplot as plt > plt.plot(np.random.rand(10), 'x-', label='first line') > plt.plot(np.random.rand(10), 'o-.', label='second line') > plt.legend(numpoints=1) > plt.show() Thank you very much, that looks great! Regards Stéfan - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] PNG transparency
Michael Droettboom wrote: > I don't understand why anyone would want the one on the left, > but if you can provide a use case for it, it should be implementable. I know I can't. I think john may be right that it's just not that hard to do by hand. -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] - Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
