New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
matploblib ignoring the switching of rendering backends #1703
Comments
Just use a GUI backend, e.g. Qt4Agg and use "savefig", rather than "show" when you want to save to disk. (Assuming here that interactive mode is off). |
There were some bugs fixed over the summer with respect to backend |
I think the OP is running into a fundamental limitation in the way backends are handled, both in ipython and in mpl, such that you really cannot switch gui backends, or switch from a non-gui to a gui. You can switch non-gui backends--or at least this is supposed to work, but I don't think it gets much testing, if any. I don't see much point in switching non-gui backends, though, since from any backend, one can use savefig to save to any supported output format. |
I think switching GUIs is just a hard problem, when you have multiple event loops involved, each of which wants to handle things slightly differently. @efiring: Switching non-gui backends gets a lot of testing, since that's what happens under the hood everytime you save to a file type that is not handled natively by the backend -- it's just that calling |
On 2013/02/11 10:52 AM, Michael Droettboom wrote:
Exactly. It is a major feature request for both mpl and ipython. |
On 2013/02/11 10:52 AM, Michael Droettboom wrote:
I'm not sure that it was ever necessary, at least during the last This is distinguished from backend_bases.switch_backends(), which is a |
Closing this as it has had no action in the last year and will probably involve a major overhaul of the backend system to fix. This maybe addressed in how @mdehoon suggests re-doing the event loop. I see the advantage of being able to switch from inline to not-inline in ipython notebooks, but that involves a lot of code which is theirs. I do not see why you would want to change the gui backend mid-stream. |
Say I have a python script that I call from IPython. I would like this script to
fig.savefig(path_to_file)
, without showing them on screen.Is this currently possible within the same script?
I have tried with:
with no luck (matplotlib seems to ignore my calls to switch backends). Is there anything that I am doing wrong?
Also, if I have a Python script that starts with:
and then I run the script for the first time, from my IPython session, and then I change the rendering backend in the script:
and then I run it again from the same IPython session, the changes do not seem to take effect. However, as soon as I restart IPython the backend specification is taken into consideration.
This is all with the latest stable versions of Python, matplotlib and IPython.
For reference I have also posted this issue in the IPython repository, since I am not sure which projects this issue would really belong to.
The text was updated successfully, but these errors were encountered: