Show More
@@ -729,20 +729,26 b' def set_matplotlib_formats(*formats, **kwargs):' | |||||
729 |
|
729 | |||
730 | To set this in your config files use the following:: |
|
730 | To set this in your config files use the following:: | |
731 |
|
731 | |||
732 |
c.InlineBackend.figure_formats = {'p |
|
732 | c.InlineBackend.figure_formats = {'png', 'jpeg'} | |
733 |
c.InlineBackend.quality |
|
733 | c.InlineBackend.print_figure_kwargs.update({'quality' : 90}) | |
734 |
|
734 | |||
735 | Parameters |
|
735 | Parameters | |
736 | ---------- |
|
736 | ---------- | |
737 |
*formats : |
|
737 | *formats : strs | |
738 |
One or |
|
738 | One or more figure formats to enable: 'png', 'retina', 'jpeg', 'svg', 'pdf'. | |
739 | quality : int |
|
739 | **kwargs : | |
740 | A percentage for the quality of JPEG figures. Defaults to 90. |
|
740 | Keyword args will be relayed to ``figure.canvas.print_figure``. | |
741 | """ |
|
741 | """ | |
742 | from IPython.core.interactiveshell import InteractiveShell |
|
742 | from IPython.core.interactiveshell import InteractiveShell | |
743 | from IPython.core.pylabtools import select_figure_formats |
|
743 | from IPython.core.pylabtools import select_figure_formats | |
|
744 | from IPython.kernel.zmq.pylab.config import InlineBackend | |||
|
745 | # build kwargs, starting with InlineBackend config | |||
|
746 | kw = {} | |||
|
747 | cfg = InlineBackend.instance() | |||
|
748 | kw.update(cfg.print_figure_kwargs) | |||
|
749 | kw.update(**kwargs) | |||
744 | shell = InteractiveShell.instance() |
|
750 | shell = InteractiveShell.instance() | |
745 |
select_figure_formats(shell, formats, |
|
751 | select_figure_formats(shell, formats, **kw) | |
746 |
|
752 | |||
747 | @skip_doctest |
|
753 | @skip_doctest | |
748 | def set_matplotlib_close(close): |
|
754 | def set_matplotlib_close(close): |
General Comments 0
You need to be logged in to leave comments.
Login now