Skip to content

Add support for ipympl backend to magic - #9885

Closed
jenshnielsen wants to merge 2 commits into
ipython:masterfrom
jenshnielsen:ipymplsupport
Closed

jenshnielsen wants to merge 2 commits into
ipython:masterfrom
jenshnielsen:ipymplsupport

Conversation

@jenshnielsen

Copy link
Copy Markdown
Contributor

This enables you to do %matplotlib ipympl to use https://github.com/matplotlib/jupyter-matplotlib backend. In the long term I expect that the

Needs to go together with the matching change in ipykernel. Which I will open a pull request for in a moment.

I am not sure how to best handle the interdependency between this and ipykernel
With this change the backend will be added to the list of available backends via
%matplotlib --list but will not actually be functional without the change in ipykernel

Needs to go together with the matching change in ipykernel
@jenshnielsen

Copy link
Copy Markdown
Contributor Author

We could also consider having %matplotlib notebook and %matplotlib nbagg conditionally activating ipympl and falling back on the old non widget backend

@SylvainCorlay

Copy link
Copy Markdown
Member

Should I remove the enabling in ipympl.__init__ then?

@jenshnielsen

Copy link
Copy Markdown
Contributor Author

@SylvainCorlay I think this is probably the way we want to go forward but I am not sure we should remove the init in ipympl just yet.

This should also enable interactive usage but there are some issues that I need to investigate and fix before this is merged. Specifically having a cell with just a single plot command i.e.

plt.plot(range(10))

will show a figure the first time that it is executed but not if it's re executed. That currently works with %matplotlib notebook and will work with ipympl.__init__ if a plt.show() is added. I think that ipympl.__init__ does not currently activate interactive mode in matplotlib so the explicit show is needed

@takluyver takluyver added this to the 5.2 milestone Aug 19, 2016
@SylvainCorlay

Copy link
Copy Markdown
Member

This looks good to me. @takluyver are all the 5.2-milestoned issues eventually going to be backported or is the backport done as we go?

@takluyver

Copy link
Copy Markdown
Member

There's a script in the tools folder that we use to do backports whenever we're thinking about it.

@Carreau

Carreau commented Aug 24, 2016

Copy link
Copy Markdown
Member

should figure out a way to use entrypoint instead of having all backend hardcoded ?

@SylvainCorlay

SylvainCorlay commented Aug 24, 2016 •

Copy link
Copy Markdown
Member

should figure out a way to use entrypoint instead of having all backend hardcoded ?

The part of the mapping that does

'tk': 'TkAgg',
'gtk': 'GTKAgg',    
'gtk3': 'GTK3Agg',
'wx': 'WXAgg',
'qt': 'Qt4Agg', 
'qt4': 'Qt4Agg',    
'qt5': 'Qt5Agg',
'osx': 'MacOSX'
'nbagg': 'nbAgg',

could be removed if matplotlib backend names were more concise :) The other ones are about support for jupyter. I guess that this mapping could be moved to matplotlib eventually.

@jenshnielsen

Copy link
Copy Markdown
Contributor Author

The problem with backend names is that matplotlib backends are bacically 2 different things lumped together in one.

  • Which rendering engine to use. I.e. Agg, Cairo, Pdf ...
  • Which guiframework, GTK2/3, QT4/5, notebook ...

On the matplotlib side we therefore have. GTKAgg and GTKCairo and so on.
IPython only really cares about the second point since thats what determines which eventloop integration to use.

@minrk minrk mentioned this pull request Nov 18, 2016
@takluyver

Copy link
Copy Markdown
Member

Closing in favour of #10059, which is an updated copy of this.

@takluyver takluyver closed this Nov 19, 2016
@takluyver takluyver modified the milestones: no action, 5.2 Nov 19, 2016
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.

4 participants