<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I think a useful way to think about it is to ask how you’d present an x-y array of numbers if you wrote them in a table. If you saw a table:<div class=""><br class=""></div><div class="">1 3 4 7</div><div class="">2 7 8 1</div><div class="">5 9 6 5</div><div class=""><br class=""></div><div class="">and you said this was an array in x and y, I think most people would naturally assume x increases column-wise (i.e. the x-axis of the table) and y increases row-wise (i.e. the y-axis of the table). Of course the opposite is another sometimes used convention, so its not like there is any fast rule, but I find that a useful justification for the convention numpy/matplotlib use.</div><div class=""><br class=""></div><div class="">C uses the column-major order, but FORTRAN, (and hence Matlab, Numpy, and most other scientific software packages) use row-major:</div><div class=""><br class=""></div><div class=""><a href="https://en.wikipedia.org/wiki/Row-_and_column-major_order" class="">https://en.wikipedia.org/wiki/Row-_and_column-major_order</a></div><div class=""><br class=""></div><div class="">ie in numpy:</div><div class=""><br class=""></div><div class="">```</div><div class=""><div class="">In [4]: a = np.array([[1, 2, 3],[4, 5, 6]])</div><div class=""><br class=""></div><div class=""><div class="">In [6]: print(a)</div><div class="">[[1 2 3]</div><div class=""> [4 5 6]]</div></div></div><div class="">```</div><div class=""><br class=""></div><div class="">Cheers, Jody</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On 6 Jun 2019, at 07:11, Neal Becker <<a href="mailto:ndbecker2@gmail.com" class="">ndbecker2@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Actually I found this pdf</span><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://www.mubdirahman.com/assets/lecture-6---advanced-plotting.pdf" style="font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://www.mubdirahman.com/assets/lecture-6---advanced-plotting.pdf</a><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">starting at page 6 explained things quite well</span><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On Thu, Jun 6, 2019 at 10:02 AM Saito Kotaro (PSI) <</span><a href="mailto:kotaro.saito@psi.ch" style="font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">kotaro.saito@psi.ch</a><span style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">> wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class="">I went through the exact same issue some years ago and wrote a note about this confusing definition of the directions in 2D arrays.<br class="">It’s written in Japanese but I think it's still understandable for most of you who can read matplotlib and numpy codes.<br class=""><a href="https://qiita.com/skotaro/items/1bc4db69b53210d839ec" class="">https://qiita.com/skotaro/items/1bc4db69b53210d839ec</a><br class=""><br class="">I hope this would help for improving a tutorial or the documentation.<br class=""><br class="">Best regards,<br class=""><br class="">Kotaro<br class=""><br class="">//================//================//<br class="">Paul Scherrer Institut<br class="">Kotaro SAITO 斉藤耕太郎<br class="">Laboratory for Neutron Scattering and Imaging<br class="">WHGA/348<br class="">5232 Villigen PSI, Schweiz<br class="">+41 56 310 3179<br class="">kotaro.saito@psi.ch<br class="">https://sites.google.com/view/kotarosaito/<br class="">//================//================//<br class=""><br class=""><blockquote type="cite" class="">On 2019/6/ 6, at 15:42, Neal Becker <ndbecker2@gmail.com> wrote:<br class=""><br class="">My suggestion is to enhance the documentation. If there is a nice<br class="">tutorial, adding a link to it would be great.<br class="">Thanks,<br class="">Neal<br class=""><br class="">On Thu, Jun 6, 2019 at 9:39 AM Thomas Caswell <tcaswell@gmail.com> wrote:<br class=""><blockquote type="cite" class=""><br class="">There is also a tutorial addressing the ways that `origin` and `extent` interact with each other: https://matplotlib.org/tutorials/intermediate/imshow_extent.html<br class=""><br class="">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.<br class=""><br class="">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!" ;)<br class=""><br class="">Tom<br class=""><br class="">On Thu, Jun 6, 2019 at 9:31 AM Nathan Goldbaum <nathan12343@gmail.com> wrote:<br class=""><blockquote type="cite" class=""><br class="">This is discussed in the description of the "origin" keyword argument:<br class=""><br class="">origin : {'upper', 'lower'}, optional<br class=""><br class="">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'.<br class=""><br class="">Note that the vertical axes points upward for 'lower' but downward for 'upper'.<br class=""><br class=""><br class="">On Thu, Jun 6, 2019 at 9:25 AM Neal Becker <ndbecker2@gmail.com> wrote:<br class=""><blockquote type="cite" class=""><br class="">I just wasted quite a bit of time trying to debug my code. It took a long<br class="">time because I was using imshow to debug, and didn't know that imshow<br class="">displays a matrix not using cartesian coordinates. The axes are transposed<br class="">and one axis is reversed. The documentation doesn't mention this.<br class=""><br class="">Thanks,<br class="">Neal<br class=""><br class="">_______________________________________________<br class="">Matplotlib-users mailing list<br class="">Matplotlib-users@python.org<br class="">https://mail.python.org/mailman/listinfo/matplotlib-users<br class=""></blockquote><br class="">_______________________________________________<br class="">Matplotlib-users mailing list<br class="">Matplotlib-users@python.org<br class="">https://mail.python.org/mailman/listinfo/matplotlib-users<br class=""></blockquote><br class=""><br class=""><br class="">--<br class="">Thomas Caswell<br class="">tcaswell@gmail.com<br class=""></blockquote><br class=""><br class=""><br class="">--<br class="">Those who don't understand recursion are doomed to repeat it<br class="">_______________________________________________<br class="">Matplotlib-users mailing list<br class="">Matplotlib-users@python.org<br class="">https://mail.python.org/mailman/listinfo/matplotlib-users<br class=""></blockquote><br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">--<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Those who don't understand recursion are doomed to repeat it</span><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Matplotlib-users mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="mailto:Matplotlib-users@python.org" style="font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">Matplotlib-users@python.org</a><br style="caret-color: rgb(0, 0, 0); font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><a href="https://mail.python.org/mailman/listinfo/matplotlib-users" style="font-family: BitstreamVeraSansMono-Roman; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mail.python.org/mailman/listinfo/matplotlib-users</a></div></blockquote></div><br class=""><div class="">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; font-variant-ligatures: normal; font-variant-east-asian: normal; font-variant-position: normal; line-height: normal;"><div style="word-wrap: break-word;" class=""><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Sans Typewriter'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px;"><div class="">--</div><div class="">Jody Klymak </div><div class=""><a href="http://web.uvic.ca/~jklymak/" class="">http://web.uvic.ca/~jklymak/</a></div><div class=""><br class="khtml-block-placeholder"></div><div class=""><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></div></span><br class="Apple-interchange-newline">
</div>
<br class=""></div></body></html>