[IPython-User] Displaying multiple images?

Jon Wilson jsw@fnal....
Thu Nov 15 09:40:08 CST 2012


Since imshow is a pyplot function, the first time it is called, it 
creates a figure object for you.  Then subsequent calls only draw to 
that already existing figure.  So you can create multiple figures by hand:

for i in range(0,3):
     fig, ax = subplots(1,1)
     img = plt.imread('image-'+i+'.png')
     imshow(img)

But since you're really just displaying images and not creating plots, 
the ipython display(Image(...)) technique others have suggested is 
probably better.
Regards,
Jon

On 11/15/2012 07:20 AM, Darren Govoni wrote:
>
> Hi,
>
>   I am wanting to display multiple images in a loop and have each one 
> displyed in my notebook. For example:
>
> for i in range(0,3):
>
>     img = plt.imread('image-'+i+'.png')
>
>     imshow(img)
>
> But it only shows one image instead of 4.
>
> How can I display multiple images from a cell?
>
> thanks!
>
>
>
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20121115/7849fc8c/attachment.html 


More information about the IPython-User mailing list