-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Conversation
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' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ;)
There was a problem hiding this comment.
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.
Support matplotlib's Gtk3 backend in --pylab mode
Support matplotlib's Gtk3 backend in --pylab mode
If you set the matplotlib backend to
Gtk3Agg
orGtk3Cairo
inmatplotlibrc
and then start upipython --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.