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 !

有帮助吗?

解决方案 2

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.

其他提示

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...

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)

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top