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

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

Merged
merged 1 commit into from Dec 4, 2013

Conversation

mdboom
Copy link
Contributor

@mdboom mdboom commented Dec 4, 2013

If you set the matplotlib backend to Gtk3Agg or Gtk3Cairo in matplotlibrc and then start up ipython --pylab, no plots are shown.

Fortunately, the hard bit of supporting a Gtk3 eventloop has already been done, it just needs the mapping so it knows to use it.

@mdboom
Copy link
Contributor Author

mdboom commented Dec 4, 2013

matplotlib/matplotlib#2646 is also required to prevent crashing on the matplotlib side.

@@ -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.

takluyver added a commit that referenced this pull request Dec 4, 2013
Support matplotlib's Gtk3 backend in --pylab mode
@takluyver takluyver merged commit e992cff into ipython:master Dec 4, 2013
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Support matplotlib's Gtk3 backend in --pylab mode
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

3 participants