Skip to content

Commit

Permalink
Switch correctly to the user's default matplotlib backend after inline.
Browse files Browse the repository at this point in the history
If '%matplotlib inline' was called first, we'd incorrectly revert to
inline when plain '%matplotlib' was called, instead of loading the
user's default GUI.  If the user called '%matplotlib' first (without
'inline') it worked correctly, but not in the other order.

The fix is to read the backend from the original defaults, not from
the runtime data structure.
  • Loading branch information
fperez committed Sep 19, 2013
1 parent bc6128a commit bbb4baa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion IPython/core/pylabtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ def find_gui_and_backend(gui=None, gui_select=None):
# select backend based on requested gui
backend = backends[gui]
else:
backend = matplotlib.rcParams['backend']
# We need to read the backend from the original data structure, *not*
# from mpl.rcParams, since a prior invocation of %matplotlib may have
# overwritten that.
backend = matplotlib.rcParamsOrig['backend']
# In this case, we need to find what the appropriate gui selection call
# should be for IPython, so we can activate inputhook accordingly
gui = backend2gui.get(backend, None)
Expand Down

0 comments on commit bbb4baa

Please sign in to comment.