[Matplotlib-users] please document imshow axes order

Neal Becker ndbecker2 at gmail.com
Thu Jun 6 09:42:28 EDT 2019


My suggestion is to enhance the documentation.  If there is a nice
tutorial, adding a link to it would be great.
Thanks,
Neal

On Thu, Jun 6, 2019 at 9:39 AM Thomas Caswell <tcaswell at gmail.com> wrote:
>
> There is also a tutorial addressing the ways that `origin` and `extent` interact with each other: https://matplotlib.org/tutorials/intermediate/imshow_extent.html
>
> As for the transpose, that is due to one branch of math teaching use to think (x, y) and different branch of math teaching us to think (row, column).  For `imshow` we use the second one which is consistent with how numpy's repr of on array.  It would be confusing if the data for `my_array[0, :]` was displayed as the first _column_ of the image.
>
> I do not disagree that this is frustrating/confusing, there is a comment in some of my grad school code which is basically "getting the (x,y) vs (r,c) conversions right here took you an afternoon, don't touch this again!" ;)
>
> Tom
>
> On Thu, Jun 6, 2019 at 9:31 AM Nathan Goldbaum <nathan12343 at gmail.com> wrote:
>>
>> This is discussed in the description of the "origin" keyword argument:
>>
>> origin : {'upper', 'lower'}, optional
>>
>> Place the [0,0] index of the array in the upper left or lower left corner of the axes. The convention 'upper' is typically used for matrices and images. If not given, rcParams["image.origin"] is used, defaulting to 'upper'.
>>
>> Note that the vertical axes points upward for 'lower' but downward for 'upper'.
>>
>>
>> On Thu, Jun 6, 2019 at 9:25 AM Neal Becker <ndbecker2 at gmail.com> wrote:
>>>
>>> I just wasted quite a bit of time trying to debug my code.  It took a long
>>> time because I was using imshow to debug, and didn't know that imshow
>>> displays a matrix not using cartesian coordinates.  The axes are transposed
>>> and one axis is reversed.  The documentation doesn't mention this.
>>>
>>> Thanks,
>>> Neal
>>>
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users at python.org
>>> https://mail.python.org/mailman/listinfo/matplotlib-users
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users at python.org
>> https://mail.python.org/mailman/listinfo/matplotlib-users
>
>
>
> --
> Thomas Caswell
> tcaswell at gmail.com



-- 
Those who don't understand recursion are doomed to repeat it


More information about the Matplotlib-users mailing list