Skip to content
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

Switch correctly to the user's default matplotlib backend after inline. #4230

Merged
merged 3 commits into from Sep 25, 2013

Conversation

fperez
Copy link
Member

@fperez fperez commented Sep 19, 2013

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.

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.
@minrk
Copy link
Member

minrk commented Sep 19, 2013

Seems sensible enough - has rcParamsOrig been around long enough that we don't need a check on older matplotlibs (I just don't know).

@fperez
Copy link
Member Author

fperez commented Sep 19, 2013

It's been there in mpl since 1.1.0, which was released in February 2012. Mpl 1.0 didn't have it.

I'm inclined not to cruft up our code with too many protections for old third-party libraries in general. What do you think? I just hate layers and layers of try/except for that kind of thing, which then take years to clean up (since nobody is going to remember to go back in a year to remove it).

@Carreau
Copy link
Member

Carreau commented Sep 19, 2013

We should probably think of a mechanism that warn/raise on IPython version bump to force us to clean things.

Something along :

with deprecate(warn=2.0, error=3.0):
    # log.warn if IPython version > 2.0
    # log.error (eventually die) if IPython > 3.0
    (do stuff)

Can do the same with decorator.

This would also make our plan more visible for people tweeking the code.

@minrk
Copy link
Member

minrk commented Sep 19, 2013

It seems pretty significant that this change means %matplotlib won't work on matplotlib 1.0.

@ellisonbg
Copy link
Member

Yes, that is probably too aggressive.

@fperez
Copy link
Member Author

fperez commented Sep 20, 2013

I'll add info about 1.1 being required (comment in block, a box in the docs).

@fperez
Copy link
Member Author

fperez commented Sep 25, 2013

I think this one's good to go, as best I can tell. Let me know if you guys spot anything else.

minrk added a commit that referenced this pull request Sep 25, 2013
Switch correctly to the user's default matplotlib backend after inline.

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.

Requires matplotlib 1.1
@minrk minrk merged commit a562753 into ipython:master Sep 25, 2013
minrk added a commit that referenced this pull request Dec 24, 2013
…backend after inline.

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.
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Switch correctly to the user's default matplotlib backend after inline.

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.

Requires matplotlib 1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants