Whenever I call show()
in matplotlib the plot window appears behind all other windows and I have to minimize everything to see it. Is there any way I can prevent this or programmatically bring it to the front. On OSX Lion. Python 2.7
Well. This answer is presented in the comments to the accepted answer but I think it deserves to have a place as a separate one as it solves the issue nicely. Besides the author's problem I additionally had the problem that matplotlib window wasn't in the tray of active windows so I couldn't switch to it by <Alt>+<Tab>
.
Changing of the matplotlib's default backend macosx
solved everything. You can try immediately in your code like this:
import matplotlib
matplotlib.use("Qt5agg")
Qt5agg
might not be presented in your system then please pick the one that is. You can find them:
import matplotlib.rcsetup as rcsetup
print(rcsetup.all_backends)
If it helped then you might want to change your backend in the configuration. For that locate it first:
import matplotlib
matplotlib.matplotlib_fname()
Then change backend:
value:
backend : macosx
to your backend. I used in the end:
backend : TkAgg
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With