[Numpy-discussion] Question about slicing
Sat May 16 17:22:11 CDT 2009
Sat, 16 May 2009 22:05:16 +0000, Jorge Scandaliaris wrote:
> I downloaded the scipy logo:
> http://docs.scipy.org/doc/_static/scipyshiny_small.png and did the
> img = Image.open('./scipyshiny_small.png')
> mpl.pylab.imshow(img) # Comes upside down
> aimg = asarray(img)
> mpl.pylab.imshow(aimg) # Comes OK
Ah, that was it. Apparently, matplotlib imshow uses a different
conversion mechanism if the input is a Image.Image from PIL, than if it
is an array. There's a dedicated function matplotlib.image.pil_to_array
which seems to work differently from asarray.
This may actually be a bug in matplotlib; perhaps you should ask the
people on the matplotlib lists if this is really the intended behavior.
More information about the Numpy-discussion