[Numpy-discussion] Size/Shape

Brady McCary brady.mccary at gmail.com
Wed Jul 17 13:21:43 EDT 2013

NumPy Folks,

Would someone please discuss or point me to a discussion about the
discrepancy in size vs shape in the following MWE? In this example I
have used a grayscale PNG version of the ImageMagick logo, but any
image which is not square will do.

$ python
Python 2.7.4 (default, Apr 19 2013, 18:28:01)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
>>> import matplotlib.pyplot as plt
>>> s = 'logo.png'
>>> im = Image.open(s)
>>> ar = plt.imread(s)
>>> im.size
(640, 480)
>>> ar.shape
(480, 640)

The extents/shape of the NumPy array (as loaded by matplotlib, but
this convention seems uniform through NumPy) are transposed from what
seems to be the usual convention. Why was this choice made?


More information about the NumPy-Discussion mailing list