2

I am using spyder with python to plot some images with matplotlib. When I generate a figure it is not showed on top of the windows, but hidden.

How can I get the figures on top?

I have this problem in Windows and Linux.

This is the code:

plt.figure(0) plt.imshow(img) 

Thanks for your help !

4 Answers 4

3

I had the same problem, with Spyder 3.3.2, (python 3.7) and QT5 backend. The answer in this older query says you may use a trick with TkAgg backend. (at least, the trick does not work with my QT5 backend)

So I switched the backend in Spyder preferences (Tools==> Preferences ==> Ipython ==> Graphis ==> backend). and now, my windows already comes on top without any other tricks...

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

2 Comments

This works and should be the accepted answer. I use Spyder v4.2.3
Works for me, and solves the problem better than the currently accepted answer.
1

Unfortunately there is no way to do what you're asking for because Matplotlib doesn't have the functionality to make it possible. See this issue for more details.

Comments

0

This has been bugging me for a while and I've discovered an answer in an older query

Basically, make window "always on top", then undo that so that other windows can then come on top again.

Code to add after your plot:

#Put figure window on top of all other windows fig.canvas.manager.window.attributes('-topmost', 1) #After placing figure window on top, allow other windows to be on top of it later fig.canvas.manager.window.attributes('-topmost', 0) 

1 Comment

This is only valid with the TkAgg backend. You may only change backend before you load pyplot. In Spyder, you may define in preferences the Backend "Tkinter", And then, the figure comes alone on top !!!
0

I met the same problem yesterday. but I found that if you open the Ipython qtconsole at the same time, the figure window will turn out

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.