Show More
@@ -173,6 +173,16 b' def mpl_runner(safe_execfile):' | |||
|
173 | 173 | return mpl_execfile |
|
174 | 174 | |
|
175 | 175 | |
|
176 | def _reshow_nbagg_figure(fig): | |
|
177 | """reshow an nbagg figure""" | |
|
178 | try: | |
|
179 | reshow = fig.canvas.manager.reshow | |
|
180 | except AttributeError: | |
|
181 | raise NotImplementedError() | |
|
182 | else: | |
|
183 | reshow() | |
|
184 | ||
|
185 | ||
|
176 | 186 | def select_figure_formats(shell, formats, **kwargs): |
|
177 | 187 | """Select figure formats for the inline backend. |
|
178 | 188 | |
@@ -185,6 +195,7 b' def select_figure_formats(shell, formats, **kwargs):' | |||
|
185 | 195 | **kwargs : any |
|
186 | 196 | Extra keyword arguments to be passed to fig.canvas.print_figure. |
|
187 | 197 | """ |
|
198 | import matplotlib | |
|
188 | 199 | from matplotlib.figure import Figure |
|
189 | 200 | from ipykernel.pylab import backend_inline |
|
190 | 201 | |
@@ -200,6 +211,10 b' def select_figure_formats(shell, formats, **kwargs):' | |||
|
200 | 211 | |
|
201 | 212 | [ f.pop(Figure, None) for f in shell.display_formatter.formatters.values() ] |
|
202 | 213 | |
|
214 | if matplotlib.backends.backend.lower() == 'nbagg': | |
|
215 | formatter = shell.display_formatter.ipython_display_formatter | |
|
216 | formatter.for_type(Figure, _reshow_nbagg_figure) | |
|
217 | ||
|
203 | 218 | supported = {'png', 'png2x', 'retina', 'jpg', 'jpeg', 'svg', 'pdf'} |
|
204 | 219 | bad = formats.difference(supported) |
|
205 | 220 | if bad: |
General Comments 0
You need to be logged in to leave comments.
Login now