From: Tobias W. <wi...@ph...> - 2010-07-22 15:18:31
|
Dear all, in matplotlib version 0.99.0 when drawing images with imshow into figures with hammer or aitoff axes the images are clipped to the axes. Now this has changed in and the images are drawn also outside the axes (version 0.99.3) or not drawn at all (version 1.0.0). How can I clip them again to the axes? Best regards, Tobias |
From: Michael D. <md...@st...> - 2010-07-22 16:58:39
|
Which backend are you using? Can you provide a short script that reproduces the bug? Mike On 07/22/2010 11:18 AM, Tobias Winchen wrote: > Dear all, > > in matplotlib version 0.99.0 when drawing images with imshow into figures with > hammer or aitoff axes the images are clipped to the axes. Now this has changed > in and the images are drawn also outside the axes (version 0.99.3) or not > drawn at all (version 1.0.0). How can I clip them again to the axes? > > Best regards, > > Tobias > > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Tobias W. <wi...@ph...> - 2010-07-23 07:36:21
|
Hi, > On Thursday 22 July 2010 Michael Droettboom wrote: > Which backend are you using? I tried this with GTKAgg and Qt4Agg, its was working with 0.99.0 and 0.99.1 on Debian/Squeeze and 0.99.0 on Scientific Linux 5. I first noticed this with 0.99.3 on Debian/Squeeze, but it is the same with with 1.0.0 on Debian/Squeeze and Scientific Linux 5. > Can you provide a short script that > reproduces the bug? This script reproduces the behaviour: import pylab from math import * d = [[1,2],[3,4]] f = pylab.figure() pylab.subplot(111, projection='hammer') pylab.imshow(d, extent=(-pi,pi,-pi/2,pi/2)) f.show() It creates the following plot in version 0.99.0 http://web.physik.rwth-aachen.de/~winchen/mpl_0990.png and in version 0.99.3 http://web.physik.rwth-aachen.de/~winchen/mpl_0993.png Best regards, Tobias |
From: Michael D. <md...@st...> - 2010-07-23 16:23:00
|
I've traced this back to revision 7867: http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/branches/v0_99_maint/lib/matplotlib/axes.py?r1=7867&r2=7866&pathrev=7867 <http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/branches/v0_99_maint/lib/matplotlib/axes.py?r1=7867&r2=7866&pathrev=7867> Andrew: I'm sure that change is there for a good reason -- do you remember what it was? I don't just want to revert it. Interestingly, get_clip_on() is True by default, and I'm not sure in what case it's set to False in this context. Mike On 07/23/2010 03:36 AM, Tobias Winchen wrote: > Hi, > > >> On Thursday 22 July 2010 Michael Droettboom wrote: >> Which backend are you using? >> > I tried this with GTKAgg and Qt4Agg, its was working with 0.99.0 and 0.99.1 on > Debian/Squeeze and 0.99.0 on Scientific Linux 5. I first noticed this with > 0.99.3 on Debian/Squeeze, but it is the same with with 1.0.0 on Debian/Squeeze > and Scientific Linux 5. > > >> Can you provide a short script that >> reproduces the bug? >> > This script reproduces the behaviour: > > > import pylab > from math import * > > d = [[1,2],[3,4]] > > f = pylab.figure() > pylab.subplot(111, projection='hammer') > > pylab.imshow(d, extent=(-pi,pi,-pi/2,pi/2)) > f.show() > > > It creates the following plot in version 0.99.0 > http://web.physik.rwth-aachen.de/~winchen/mpl_0990.png > > and in version 0.99.3 > http://web.physik.rwth-aachen.de/~winchen/mpl_0993.png > > Best regards, > > > Tobias > > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > > > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA |
From: Michael D. <md...@st...> - 2010-07-23 13:31:10
|
BTW -- I think a possible fix may be to do: if not im.get_clip_path(): im.set_clip_path(self.patch) Mike On 07/23/2010 09:16 AM, Michael Droettboom wrote: > I've traced this back to revision 7867: > > http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/branches/v0_99_maint/lib/matplotlib/axes.py?r1=7867&r2=7866&pathrev=7867 > <http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/branches/v0_99_maint/lib/matplotlib/axes.py?r1=7867&r2=7866&pathrev=7867> > > Andrew: I'm sure that change is there for a good reason -- do you > remember what it was? I don't just want to revert it. Interestingly, > get_clip_on() is True by default, and I'm not sure in what case it's > set to False in this context. > > Mike > > On 07/23/2010 03:36 AM, Tobias Winchen wrote: >> Hi, >> >> >>> On Thursday 22 July 2010 Michael Droettboom wrote: >>> Which backend are you using? >>> >> I tried this with GTKAgg and Qt4Agg, its was working with 0.99.0 and 0.99.1 on >> Debian/Squeeze and 0.99.0 on Scientific Linux 5. I first noticed this with >> 0.99.3 on Debian/Squeeze, but it is the same with with 1.0.0 on Debian/Squeeze >> and Scientific Linux 5. >> >> >>> Can you provide a short script that >>> reproduces the bug? >>> >> This script reproduces the behaviour: >> >> >> import pylab >> from math import * >> >> d = [[1,2],[3,4]] >> >> f = pylab.figure() >> pylab.subplot(111, projection='hammer') >> >> pylab.imshow(d, extent=(-pi,pi,-pi/2,pi/2)) >> f.show() >> >> >> It creates the following plot in version 0.99.0 >> http://web.physik.rwth-aachen.de/~winchen/mpl_0990.png >> >> and in version 0.99.3 >> http://web.physik.rwth-aachen.de/~winchen/mpl_0993.png >> >> Best regards, >> >> >> Tobias >> >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by Sprint >> What will you do first with EVO, the first 4G phone? >> Visit sprint.com/first --http://p.sf.net/sfu/sprint-com-first >> >> >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > > -- > Michael Droettboom > Science Software Branch > Space Telescope Science Institute > Baltimore, Maryland, USA -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA |
From: Andrew S. <str...@as...> - 2010-07-23 15:31:19
|
On 7/23/10 3:16 PM, Michael Droettboom wrote: > I've traced this back to revision 7867: > > http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/branches/v0_99_maint/lib/matplotlib/axes.py?r1=7867&r2=7866&pathrev=7867 > <http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/branches/v0_99_maint/lib/matplotlib/axes.py?r1=7867&r2=7866&pathrev=7867> > > Andrew: I'm sure that change is there for a good reason -- do you > remember what it was? I don't just want to revert it. Interestingly, > get_clip_on() is True by default, and I'm not sure in what case it's > set to False in this context. Hi Mike, I don't remember this. But looking back at the commit logs, I see "imshow: only apply axes patch clipping if image doesn't clip itself" as the original commit message and then a few minutes later I committed the test test_imshow_clip() in text_axes.py. It looks like I was responding to a bug and/or patch submission. As long as that test still passes, I think it's OK to check in your fix. We could also add Tobias' script as another test. -Andrew |
From: Tobias W. <wi...@ph...> - 2010-07-26 16:18:34
|
Hi, thank you for your quick answers which pointed me to a solution: setting clip_on=False solves the problem: pylab.imshow(d, extent=(-pi,pi,-pi/2,pi/2), clip_on=False) However, for me it feels not very intuitive to write clip_on=False to activate the desired clipping. Tobias |