[matplotlib-devel] [patch] Raise figures on pylab.show() with Qt4 backend
Hi all, I've just tried the Qt4 backend and noticed that, different from the previous backend I was using, the last command of a script pylab.show() does not raise the figures to the front (they show up but in the background). This is the case at least on my OS X machine. I personally feels like the figures taking becoming the active windows should be the right behavior. In case, this is valuable to the project, please find below at patch that achieves that behavior. Regards, -Gellule Index: lib/matplotlib/backends/backend_qt4.py === --- lib/matplotlib/backends/backend_qt4.py (revision 7293) +++ lib/matplotlib/backends/backend_qt4.py (working copy) @@ -67,6 +67,7 @@ figManager = Gcf.get_active() if figManager != None: figManager.canvas.draw() +figManager.window.raise_() if _create_qApp.qAppCreatedHere: QtGui.qApp.exec_() -- ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] pylab.imshow() does not handle clip_path properly
This is a bug report for matplotlib version 0.99.1.1
The clip_path keyword of imshow() does not work when setting it to
(Path, Transform) for two reasons:
1. On line 622 of artist.py, v is now the tuple (Path,Transform) and
should be apply to func with apply(func,v). Hence the following
suggested change:
for k,v in props.items():
func = getattr(self, 'set_'+k, None)
if func is None or not callable(func):
raise AttributeError('Unknown property %s'%k)
if type(v) is tuple:
>apply(func,v)
else:
func(v)
changed = True
2. On line 6278 of axes.py, im.set_clip_path(self.patch) should not
overwrite the clip path if already set. Hence the following suggested
change:
im.set_data(X)
im.set_alpha(alpha)
self._set_artist_props(im)
if not im._clipon:
>im.set_clip_path(self.patch)
#if norm is None and shape is None:
#im.set_clim(vmin, vmax)
if vmin is not None or vmax is not None:
im.set_clim(vmin, vmax)
else:
im.autoscale_None()
im.set_url(url)
--
Come build with us! The BlackBerry(R) 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/devconference
___
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] pylab.imshow() does not handle clip_path properly
>> This is a bug report for matplotlib version 0.99.1.1 >> >> The clip_path keyword of imshow() does not work when setting it to >> (Path, Transform) for two reasons: > > Hi, Thanks for the report. Do you have a simple test script that we can > use to see the problem and then fix it? We will then use this as the > basis to create a test function to make sure the issue never "crops" up > again. > > -Andrew Hi Andrew, Please try the following. It's a script that clips an NxN image based on its contour. Thanks, -Julien import numpy import pylab #Create a NxN image N=100 (x,y) = numpy.indices((N,N)) x -= N/2 y -= N/2 r = numpy.sqrt(x**2+y**2-x*y) #Create a contour plot at N/4 and extract both the clip path and transform c=pylab.contour(r,[N/4]) clipPath = c.collections[0].get_paths()[0] clipTransform = c.collections[0].get_transform() #Plot the image clipped by the contour pylab.imshow(r, clip_path=(clipPath,clipTransform)) pylab.show() -- Come build with us! The BlackBerry(R) 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/devconference ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Problems with blocking_input.py (and fixes?)
I'm having some regression issues with 0.99.1.1 compared to 0.98.5.3 in "blocking_input.py". I'm using pylab.clabel(...,manual=True) expecting my figure to ask me to input the locations of the contour labels. All was fine in 0.98.5.3, it does not seem to work with 0.99.1.1. After some investigations I found: 1. With rev 7591, the button1, button2, and button3 methods in the BlockingMouseInput class have been renamed to mouse_event_add, mouse_event_stop, and mouse_event_stop. To date, these changes have not been made to BlockingContourLabeler which still has the button1 and button2 method that are in charge of actually adding and removing the new labels, and that are never called. Replacing button1 by mouse_event_add and button3 by mouse_event_pop seems to return the "manually add contour label" functionality. 2. After that change, I get a crash on mouse_button_stop in BlockingMouseInput on line 196: TypeError: stop_event_loop() takes exactly 1 argument (2 given) After confirmation from the docuemntation that stoip_event_loop() should indeed not take any argument I would fix line 196 with: < self.fig.canvas.stop_event_loop(event) > self.fig.canvas.stop_event_loop() -Julien -- Come build with us! The BlackBerry(R) 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/devconference ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Test invitation: activate figure windows for non-interactive macosx backend
If you are a macosx backend user, you are welcomed to test the following branch: https://github.com/gellule/matplotlib. With the branch, when issuing a pylab.show() in non-interactive mode, the plot windows should appear in the foreground with focus, instead of appearing in the background. It should make things a little easier for you. I am also curious to know what people think of making pylab.show() also yield the focus to the plot windows in -interactive- mode? All the other commands update the plot windows automatically, keeping the focus in the python interpreter. So pylab.show() would only do that: yield the focus to the plot windows. That is not in the branch (yet). Cheers, -Gellule/Julien -- RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Test invitation: activate figure windows for non-interactive macosx backend
On 1/13/12 12:53 , Tony Yu wrote: > > On Thu, Jan 12, 2012 at 1:37 PM, Gellule Xg <mailto:[email protected]>> wrote: > > If you are a macosx backend user, you are welcomed to test the following > branch: https://github.com/gellule/matplotlib. With the branch, when > issuing a pylab.show() in non-interactive mode, the plot windows should > appear in the foreground with focus, instead of appearing in the > background. It should make things a little easier for you. > > > This works as advertised on my system (plot window grabs focus when > running scripts in MacVim, Terminal, and IPython when in non-interactive > mode). Unfortunately, I tend to use the QT4Agg backend, which also > leaves plot windows in the background. Maybe I'd switch to the macosx > backend with this addition. Thanks! > I am also curious to know what people think of making pylab.show() also > yield the focus to the plot windows in -interactive- mode? All the other > commands update the plot windows automatically, keeping the focus in the > python interpreter. So pylab.show() would only do that: yield the focus > to the plot windows. That is not in the branch (yet). > > > I'd lean toward no: the plot window shouldn't grab focus in interactive > mode. I have some scripts that take command-line input in-between plot > calls. If the plot window grabbed focus, then I'd have to switch focus > back to enter input. This probably isn't a common use case, though. But you don't use show() in interactive mode, do you? The focus grab would not happen until you call show(). I other words, show() would always send the focus to the plot windows. But depending on how interactive is set, it would block or not. If you are in interactive mode and don't want to send the focus to the plot windows, you would have to not call show(). -Julien -- RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] macosx backend: Move all figures to front with non-interactive show()
Dear macosx backend users, Could you please have a look at pull request https://github.com/matplotlib/matplotlib/pull/1036. It removes a minor annoyance where only the last figure would appear to the front after issuing a non-interactive show(). It builds upon https://github.com/matplotlib/matplotlib/pull/663, delivered with matplotlib 1.1.1. Cheers, -Gellule -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
