0

I'm trying to figure out how ginput(3) works in this code, but when I run it, it returning a UserWarning saying: "matplotlib is currently using a non-GUI backend, "

Please help me out on this.

from PIL import Image
from pylab import *
im = array(Image.open('empire.jpg'))
imshow(im)
print ('Please click 3 points')
x = ginput(3)
print ('you clicked:',x)
show()

UserWarning: matplotlib is currently using a non-GUI backend, so cannot show the figure "matplotlib is currently using a non-GUI backend, "

4
  • This can be taken literally. Matplotlib uses a non-GUI backend. See the link on how to change the backend. Commented Feb 7, 2019 at 11:25
  • @ImportanceOfBeingErnest So what can be done to eliminate this warning that I'm facing ? Commented Feb 7, 2019 at 15:59
  • Follow the instructions in the link to set a different backend. Commented Feb 7, 2019 at 16:00
  • @ImportanceOfBeingErnest that did the work, Thank you! Commented Feb 7, 2019 at 16:28

1 Answer 1

0

You can take a quick look at what a backend in matplotlib refers to, by checking out this link.

Thanks @ImportanceOfBeingErnest for providing me with the necessary resource.

import matplotlib

#Use the line below to set a backend for matplotib
matplotlib.use('TkAgg')

from PIL import Image
from pylab import *

im = array(Image.open('empire.jpg'))
imshow(im)

print ('Please click 3 points')
x = ginput(3)

print ('you clicked:',x)
show()

You could try out these other GUI backends in the given order, if "TkAgg" doesn't work out for you.

  • WX
  • QTAgg
  • QT4Agg
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.