1

If I do the following commands in iPython or just Python,

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img=mpimg.imread('stinkbug.png')
imgplot = plt.imshow(img)

then nothing happens (no image appear anywhere).

But if I do the following commands:

import scipy.misc as misc
img=misc.imread('stinkbug.png')
misc.imshow(img)

then image appears inside separate window of ImageMagick.

Also, I can run ipython with qtconsole and will see image with first code.

What are the difference between two different ways of diplaying images? Can they be unified, i.e. work in similar way in both consoles? Is it possible to make first code work in normal ipython/python?

1
  • I believe this is related to that question. Commented Feb 9, 2016 at 12:16

2 Answers 2

1

Add plt.show(imgplot) at the end of your code.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

My bad, I got confused. Now everything is fixed and a screenshot has been attached.
1

One line is missing to show the plot window:

plt.show()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.