On Wed, Jul 7, 2010 at 1:54 AM, Matthias Michler
<matthiasmich...@gmx.net> wrote:
> On Wednesday July 7 2010 05:53:59 jezhill wrote:
>> Hi all,
>>
>> I've been experimenting with the NonUniformImage class.  (Actually I want
>> *uniform* pixel spacing, but I want the image x and y coordinates to have
>> the correct *scaling* in the style of Matlab's  image(x,y,C).  The
>> AxesImage class, created via pylab.imshow, didn't seem to offer that, so I
>> landed on NonUniformImage, but if there's a better solution I'd be
>> grateful for tips...)
>>
>>
>> And here's the problem (or bug?):  with my Python 2.5.4 and my matplotlib
>> 1.0, I go and run the
>> http://matplotlib.sourceforge.net/examples/pylab_examples/image_nonuniform.
>> html gallery demo  but I decide that I want the y axis reversed (as is
>> common in image visualization).  So I either call
>> pylab.gca().invert_yaxis() at the end, or I change one of the lines that
>> says
>>
>> ax.set_ylim(-4,4)
>>
>> to read
>>
>> ax.set_ylim(4,-4)
>>
>> which I believe is the approved method.  However the result I get is
>> non-sensical:  no more image variation in the vertical direction. Can
>> anyone tell me what, if anything, I'm doing wrong?
>
> Hi jez,
>
> I attached a slightly modified version of the image_nonuniform.py. I
> additionally inverted the y-limits in the extent-kwarg and in the set_data of
> the last example. I'm not sure why this is needed and if there is a better
> solution to it, but at least for me it works.
> Does anybody know why we have to invert all data concerning y-axis?

We have to invert because the image data is assumed to be starting in
the upper left. You can change this assumption by passing:

orgin='lower'

All of these options are supported by imshow(), so if one has uniform
data and just needs proper data scaling, imshow() will be sufficient.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
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
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to