Michiel,

After some further digging I think the Mac OSX backend is probably OK.  
I have tried setting the backend just before I use pylab (several  
thousand lines into the code after setting up the GUI and lots of  
other stuff) the first time with code as below

def display_2d():
   global matplotlib_backend_set
   import numpy,matplotlib
   print 'here  
display2d',matplotlib_backend_set,matplotlib.rcParams['backend']
   if not matplotlib_backend_set:
     matplotlib.use('WXAgg')
#    matplotlib.use('MacOSX')
     matplotlib_backend_set=True
   print 'before pylab',matplotlib.rcParams['backend']
   import pylab
   print 'here pylab',matplotlib.rcParams['backend']

and find that if I set MacOSX backend that the import for pylab resets  
is 'WX' ...

here display2d False WX
before pylab MacOSX
here pylab WX


but if I set it to 'WXAgg' the pylab import doesn't reset it and it  
remains WxAgg ...

here display2d False WX
before pylab WXAgg
here pylab WXAgg

In the case where pylab sets WX there is the error in the x axis but  
in WXAgg there is no error. I can't say anything about the OSX backend  
though given it works on the website example code (and WX doesn't)   
its reasonable to expect it be OK. I thought I was using the MacOSX  
backend but pylab had reset it to WX behind my back ... I assumes  
pylab recognises that my GUI is written in wx and says the MacOSX is  
not the appropriate backend but it would be nice if it threw an error  
rather just switching backends and continuing without telling me  
(though I'm guessing there is no way for pylab to know that I have  
explicitly set a backend and in normal circumstances you'd like it to  
just quietly pick whatever it sees as appropriate ... and I would have  
never picked this up without the WX bug).


> Thanks for your reply.
> Just to make sure I understand correctly: Do you still think that  
> there is a bug in the Mac OS X backend? Or does the bug only appear  
> with wx?
>
> Best,
> --Michiel.
>
> --- On Thu, 11/11/10, Garry Willgoose <garry.willgo...@newcastle.edu.au 
> > wrote:
>
>> From: Garry Willgoose <garry.willgo...@newcastle.edu.au>
>> Subject: Re: [Matplotlib-users] python v ipython problem in imshow()
>> To: "Michiel de Hoon" <mjldeh...@yahoo.com>
>> Cc: "Garry Willgoose" <garry.willgo...@newcastle.edu.au>, "John  
>> Hunter" <jdh2...@gmail.com>, matplotlib-users@lists.sourceforge.net
>> Date: Thursday, November 11, 2010, 10:00 PM
>> Michiel,
>>
>> With some digging around in my own code  I have been
>> able to reproduce the bug with the matplotlib example. My
>> code uses wxPython and somewhere it sets the backend to 'WX'
>> (this seems to require a bit more than simply 'import wx'
>> but I haven't pursued what it might be ... there are several
>> thousand lines of code before I get to the plotting).
>> the code below triggers the problem
>>
>> import wx
>> import matplotlib
>> print 'matplotlib backend',matplotlib.rcParams['backend']
>> matplotlib.use('WX')
>> print 'matplotlib backend',matplotlib.rcParams['backend']
>>
>> from pylab import *
>> x = arange(100.0); x.shape = 10,10
>> interp = 'bilinear';
>> lim = -2,11,-2,6
>> subplot(211, axisbg='g')
>> title('blue should be up')
>> imshow(x, origin='upper', interpolation=interp)
>> subplot(212, axisbg='y')
>> title('blue should be down')
>> imshow(x, origin='lower', interpolation=interp)
>> show()
>>
>>
>> if I set the backend to WxAgg then the problem doesn't
>> occur and if I don't set it all (so its MacOSX) then all is
>> fine. In the example above the top graph is fine but the
>> lower one is solid yellow. This behaviour is different from
>> my code which shows the same image for both origin='upper'
>> and 'lower'. My platform is enthought 6.1-1 with matplotlib
>> 0.99.1.1.
>>
>> Given that WXAgg works are there any are the implications
>> of WXAgg early in my plotting part of the code (this may
>> result in multiple calls to set the backend) versus letting
>> matplotlib itself set WX. I just tried to set WXAgg
>> immediately after the first 'import wx' after program
>> startup but it had set to WX by the time it got the place
>> where the plots were made.
>>
>>> I haven't been able to replicate this bug. With all
>> matplotlib versions
>>> I tried (including 0.99.0, 0.99.1., 0.99.1.1,
>> 0.99.1.2, 1.0.0, and the current source code in svn), this
>> example works correctly with the Mac OS X backend.
>>> Garry, what is the exact code that you are using?
>>>
>>> --Michiel.
>>>
>>>
>>> --- On Wed, 11/10/10, John Hunter <jdh2...@gmail.com>
>> wrote:
>>>
>>>> From: John Hunter <jdh2...@gmail.com>
>>>> Subject: Re: [Matplotlib-users] python v ipython
>> problem in imshow()
>>>> To: "Michiel de Hoon" <mjldeh...@yahoo.com>
>>>> Cc: "Garry Willgoose" <garry.willgo...@newcastle.edu.au>,
>> matplotlib-users@lists.sourceforge.net
>>>> Date: Wednesday, November 10, 2010, 10:59 AM
>>>> On Wed, Nov 10, 2010 at 9:48 AM,
>>>> Michiel de Hoon <mjldeh...@yahoo.com>
>>>> wrote:
>>>>> Garry, if the bug still exists in matplotlib
>> 1.0 could
>>>> you open a bug report for it?
>>>>
>>>>
>>>> I think Gary doesn't have easy access to
>> 1.0.  Here is
>>>> the relevant
>>>> example if anyone has 1.0 on macosx to test with
>>>>
>>>>    
>>>> http://matplotlib.sourceforge.net/examples/pylab_examples/image_origin.html
>>>>
>>>> JDH
>>>>
>>>
>>>
>>>
>>>
>>>
>> ------------------------------------------------------------------------------
>>> Centralized Desktop Delivery: Dell and VMware
>> Reference Architecture
>>> Simplifying enterprise desktop deployment and
>> management using
>>> Dell EqualLogic storage and VMware View: A highly
>> scalable, end-to-end
>>> client virtualization framework. Read more!
>>> http://p.sf.net/sfu/dell-eql-dev2dev
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>> ====================================================================
>> Prof Garry Willgoose,
>> Australian Professorial Fellow in Environmental
>> Engineering,
>> Director, Centre for Climate Impact Management (C2IM),
>> School of Engineering, The University of Newcastle,
>> Callaghan, 2308
>> Australia.
>>
>> Centre webpage: www.c2im.org.au
>>
>> Phone: (International) +61 2 4921 6050 (Tues-Fri AM); +61 2
>> 6545 9574 (Fri PM-Mon)
>> FAX: (International) +61 2 4921 6991 (Uni); +61 2 6545 9574
>> (personal and Telluric)
>> Env. Engg. Secretary: (International) +61 2 4921 6042
>>
>> email:  garry.willgo...@newcastle.edu.au;
>> g.willgo...@telluricresearch.com
>> email-for-life: garry.willgo...@alum.mit.edu
>> personal webpage: www.telluricresearch.com/garry
>> ====================================================================
>> "Do not go where the path may lead, go instead where there
>> is no path and leave a trail"
>>
>>           Ralph Waldo Emerson
>> ====================================================================
>>
>>
>>
>>
>>
>>
>
>
>
>
> ------------------------------------------------------------------------------
> Centralized Desktop Delivery: Dell and VMware Reference Architecture
> Simplifying enterprise desktop deployment and management using
> Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
> client virtualization framework. Read more!
> http://p.sf.net/sfu/dell-eql-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

====================================================================
Prof Garry Willgoose,
Australian Professorial Fellow in Environmental Engineering,
Director, Centre for Climate Impact Management (C2IM),
School of Engineering, The University of Newcastle,
Callaghan, 2308
Australia.

Centre webpage: www.c2im.org.au

Phone: (International) +61 2 4921 6050 (Tues-Fri AM); +61 2 6545 9574  
(Fri PM-Mon)
FAX: (International) +61 2 4921 6991 (Uni); +61 2 6545 9574 (personal  
and Telluric)
Env. Engg. Secretary: (International) +61 2 4921 6042

email:  garry.willgo...@newcastle.edu.au; g.willgo...@telluricresearch.com
email-for-life: garry.willgo...@alum.mit.edu
personal webpage: www.telluricresearch.com/garry
====================================================================
"Do not go where the path may lead, go instead where there is no path  
and leave a trail"
                           Ralph Waldo Emerson
====================================================================






------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to