SourceForge logo
SourceForge logo
Menu

matplotlib-users

From: Yasin S. B. <yas...@gm...> - 2012年05月29日 09:31:52
Hi. I want to make sure how imshow shows a numpy array as image.
lets say below is our numpy data array where letter represent data values
and numbers represent row/col indices.
 0 1 2
0 a b c
1 d e f
2 g h i
and lets think imshow's origin is default upper left.
Now, if we show our data as an image, the orientation of visual
representation of data shouldt change,
and seen like below, right?
 0 1 2
0 a b c
1 d e f
2 g h i
But if we pass origin="lower" keyword to imshow, (as in basemap by default);
is this what we expect to see ?
 0 1 2
2 g h i
1 d e f
0 a b c
To be clear, does imshow with "lower" keyword value;
1-takes first row of data and put it most bottom,
2-then take second row and put it one row upper from most bottom.....etc ?
Thanks.
-- 
Yasin Selçuk Berber
"Bismillah, her hayrın başıdır."
On Tue, May 29, 2012 at 5:31 AM, Yasin Selçuk Berber
<yas...@gm...>wrote:
>
> Hi. I want to make sure how imshow shows a numpy array as image.
>
> lets say below is our numpy data array where letter represent data values
> and numbers represent row/col indices.
>
> 0 1 2
> 0 a b c
> 1 d e f
> 2 g h i
>
> and lets think imshow's origin is default upper left.
> Now, if we show our data as an image, the orientation of visual
> representation of data shouldt change,
> and seen like below, right?
>
> 0 1 2
> 0 a b c
> 1 d e f
> 2 g h i
>
> But if we pass origin="lower" keyword to imshow, (as in basemap by
> default);
> is this what we expect to see ?
>
> 0 1 2
> 2 g h i
> 1 d e f
> 0 a b c
>
> To be clear, does imshow with "lower" keyword value;
>
> 1-takes first row of data and put it most bottom,
> 2-then take second row and put it one row upper from most bottom.....etc ?
>
> Thanks.
>
> --
> Yasin Selçuk Berber
> "Bismillah, her hayrın başıdır."
>
>
Hi Yasin,
Yes, your interpretation looks correct to me. Image coordinates typically
have an origin at the upper left and increase downward and to the right.
Setting `origin='lower' ` essentially changes `imshow` to use data
coordinates, which typically have an origin at the bottom left and increase
upward and to the right.
Do you expect (or get) something different?
Best,
-Tony
From: Yasin S. B. <yas...@gm...> - 2012年05月31日 06:31:11
im getting that result.
but just wanted to know, could "takes first row and put it most
bottom....then take second....etc" expression be accepted as harmless or
not.
2012年5月30日 Tony Yu <ts...@gm...>
>
> On Tue, May 29, 2012 at 5:31 AM, Yasin Selçuk Berber <
> yas...@gm...> wrote:
>
>>
>> Hi. I want to make sure how imshow shows a numpy array as image.
>>
>> lets say below is our numpy data array where letter represent data values
>> and numbers represent row/col indices.
>>
>> 0 1 2
>> 0 a b c
>> 1 d e f
>> 2 g h i
>>
>> and lets think imshow's origin is default upper left.
>> Now, if we show our data as an image, the orientation of visual
>> representation of data shouldt change,
>> and seen like below, right?
>>
>> 0 1 2
>> 0 a b c
>> 1 d e f
>> 2 g h i
>>
>> But if we pass origin="lower" keyword to imshow, (as in basemap by
>> default);
>> is this what we expect to see ?
>>
>> 0 1 2
>> 2 g h i
>> 1 d e f
>> 0 a b c
>>
>> To be clear, does imshow with "lower" keyword value;
>>
>> 1-takes first row of data and put it most bottom,
>> 2-then take second row and put it one row upper from most bottom.....etc ?
>>
>> Thanks.
>>
>> --
>> Yasin Selçuk Berber
>> "Bismillah, her hayrın başıdır."
>>
>>
> Hi Yasin,
>
> Yes, your interpretation looks correct to me. Image coordinates typically
> have an origin at the upper left and increase downward and to the right.
> Setting `origin='lower' ` essentially changes `imshow` to use data
> coordinates, which typically have an origin at the bottom left and increase
> upward and to the right.
>
> Do you expect (or get) something different?
>
> Best,
> -Tony
>
>
-- 
Yasin Selçuk Berber
"Bismillah, her hayrın başıdır."
Le jeudi 31 mai 2012 à 09:31 +0300, Yasin Selçuk Berber a écrit :
> im getting that result.
> but just wanted to know, could "takes first row and put it most
> bottom....then take second....etc" expression be accepted as harmless or
> not.
Seems to, it depends on the interpretation of the expression :)
If you are thinking about data copying, IMO there is no extra copy of
the data compared to any other origin choice. You could also say that
rows of the array are displayed bottom-up for origin='lower' and
top-down for origin='upper'
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /