8000 Support matplotlib's Gtk3 backend in --pylab mode by mdboom · Pull Request #4640 · ipython/ipython · GitHub
[go: up one dir, main page]

Skip to content

Support matplotlib's Gtk3 backend in --pylab mode #4640

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

Merged
merged 1 commit into from
Dec 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support matplotlib's Gtk3 backend in --pylab mode.
  • Loading branch information
mdboom committed Dec 4, 2013
commit a34db6e6fd181ed912d14bdeae6ec925f673269e
2 changes: 2 additions & 0 deletions IPython/core/pylabtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# user's mpl default from the mpl rc structure
backends = {'tk': 'TkAgg',
'gtk': 'GTKAgg',
'gtk3': 'GTK3Agg',
'wx': 'WXAgg',
'qt': 'Qt4Agg', # qt3 not supported
'qt4': 'Qt4Agg',
Expand All @@ -46,6 +47,7 @@
# In the reverse mapping, there are a few extra valid matplotlib backends that
# map to the same GUI support
backend2gui['GTK'] = backend2gui['GTKCairo'] = 'gtk'
backend2gui['GTK3Cairo'] = 'gtk3'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be inline with the others, but I'm a bit confused about why the GUI to backend mapping has 'GTK3Agg', but the reverse mapping has GTK3Cairo.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's strictly in addition to those already in the forward mapping -

%matplotlib gtk3

implies backend=GTK3Agg

but

%matplotlib

when the backend is already either GTK3Agg or GTK3Cairo should behave the same in terms of eventloop integration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The forward mapping is used when a backend is specified on the IPython commandline (and possible elsewhere), eg.:

ipython --pylab=gtk

The backward mapping is used when the user chooses a backend in their matplotlibrc file (or some other matplotlib-based mechanism) and we need to choose the mainloop type to install in IPython to match it.

So there's a many to one mapping from matplotlib backends to IPython mainloop types.

Also, perhaps somewhat confusingly, there is a Gtk2 "Gtk" backend that uses gdk for drawing. Gdk is totally gone in Gtk3 (replaced with Cairo) so Gtk3 only has Gtk3Cairo and Gtk3Agg, whereas Gtk as Gtk (Gdk), GtkCairo and GtkAgg.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@minrk: We replied at the same time. You said it better ;)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. I'd missed that the reverse mapping is initialised with the reverse of the forwards mapping. This looks fine, then.

backend2gui['WX'] = 'wx'
backend2gui['CocoaAgg'] = 'osx'

Expand Down
0