Skip to content

Commit 3af9f0d

Browse files
committed
%config InlineBackend
1 parent 568f5b7 commit 3af9f0d

File tree

2 files changed

+60
-7
lines changed

2 files changed

+60
-7
lines changed

matplotlib_inline/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def _figure_format_changed(self, name, old, new):
7979
{"bbox_inches": "tight"},
8080
help="""Extra kwargs to be passed to fig.canvas.print_figure.
8181
82-
Logical examples include: bbox_inches, quality (for jpeg figures), etc.
82+
Logical examples include: bbox_inches, pil_kwargs, etc.
8383
""",
8484
).tag(config=True)
8585
_print_figure_kwargs_changed = _update_figure_formatters

tests/notebooks/config_InlineBackend.ipynb

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,59 @@
3232
{
3333
"cell_type": "code",
3434
"execution_count": 3,
35+
"id": "fbec64f3-9f8e-435f-8a92-8d9ba7c0beb7",
36+
"metadata": {},
37+
"outputs": [
38+
{
39+
"name": "stdout",
40+
"output_type": "stream",
41+
"text": [
42+
"InlineBackend(InlineBackendConfig) options\n",
43+
"----------------------------------------\n",
44+
"InlineBackend.close_figures=<Bool>\n",
45+
" Close all figures at the end of each cell.\n",
46+
" When True, ensures that each cell starts with no active figures, but it\n",
47+
" also means that one must keep track of references in order to edit or\n",
48+
" redraw figures in subsequent cells. This mode is ideal for the notebook,\n",
49+
" where residual plots from other cells might be surprising.\n",
50+
" When False, one must call figure() to create new figures. This means\n",
51+
" that gcf() and getfigs() can reference figures created in other cells,\n",
52+
" and the active figure can continue to be edited with pylab/pyplot\n",
53+
" methods that reference the current active figure. This mode facilitates\n",
54+
" iterative editing of figures, and behaves most consistently with\n",
55+
" other matplotlib backends, but figure barriers between cells must\n",
56+
" be explicit.\n",
57+
" Current: True\n",
58+
"InlineBackend.figure_format=<Unicode>\n",
59+
" The figure format to enable (deprecated\n",
60+
" use `figure_formats` instead)\n",
61+
" Current: ''\n",
62+
"InlineBackend.figure_formats=<set-item-1>...\n",
63+
" A set of figure formats to enable: 'png',\n",
64+
" 'retina', 'jpeg', 'svg', 'pdf'.\n",
65+
" Current: {'jpeg'}\n",
66+
"InlineBackend.print_figure_kwargs=<key-1>=<value-1>...\n",
67+
" Extra kwargs to be passed to fig.canvas.print_figure.\n",
68+
" Logical examples include: bbox_inches, pil_kwargs, etc.\n",
69+
" Current: {'bbox_inches': None, 'pil_kwargs': {'quality': 90, 'optimize': True}}\n",
70+
"InlineBackend.rc=<key-1>=<value-1>...\n",
71+
" Dict to manage matplotlib configuration defaults in the inline\n",
72+
" backend. As of v0.1.4 IPython/Jupyter do not override defaults out of\n",
73+
" the box, but third-party tools may use it to manage rc data. To change\n",
74+
" personal defaults for matplotlib, use matplotlib's configuration\n",
75+
" tools, or customize this class in your `ipython_config.py` file for\n",
76+
" IPython/Jupyter-specific usage.\n",
77+
" Current: {}\n"
78+
]
79+
}
80+
],
81+
"source": [
82+
"%config InlineBackend"
83+
]
84+
},
85+
{
86+
"cell_type": "code",
87+
"execution_count": 4,
3588
"id": "0e5b8951-19af-4273-80ca-23b47476d637",
3689
"metadata": {},
3790
"outputs": [
@@ -83,7 +136,7 @@
83136
},
84137
{
85138
"cell_type": "code",
86-
"execution_count": 4,
139+
"execution_count": 5,
87140
"id": "89f6de76-9d6b-43c0-b790-e6b63c4c4159",
88141
"metadata": {},
89142
"outputs": [
@@ -107,7 +160,7 @@
107160
},
108161
{
109162
"cell_type": "code",
110-
"execution_count": 5,
163+
"execution_count": 6,
111164
"id": "1fc45e92-07c2-49fa-9b3e-2c30e865e5e8",
112165
"metadata": {},
113166
"outputs": [
@@ -118,7 +171,7 @@
118171
"<Figure size 640x480 with 1 Axes>"
119172
]
120173
},
121-
"execution_count": 5,
174+
"execution_count": 6,
122175
"metadata": {},
123176
"output_type": "execute_result"
124177
}
@@ -131,19 +184,19 @@
131184
},
132185
{
133186
"cell_type": "code",
134-
"execution_count": 6,
187+
"execution_count": 7,
135188
"id": "df3590be-d87d-4c37-8f73-c652eec9a640",
136189
"metadata": {},
137190
"outputs": [
138191
{
139192
"data": {
140193
"text/plain": [
141-
"{'IPKernelApp': {'connection_file': '/Users/leo/Library/Jupyter/runtime/kernel-488a2b06-f50e-4bf3-98b5-f46e505f928c.json'},\n",
194+
"{'IPKernelApp': {'connection_file': '/Users/leo/Library/Jupyter/runtime/kernel-66b85c75-26bd-4e95-91ec-25b40babd080.json'},\n",
142195
" 'InlineBackend': {'figure_formats': {'jpeg', 'png'},\n",
143196
" 'print_figure_kwargs': {'bbox_inches': None, 'pil_kwargs': {'quality': 90}}}}"
144197
]
145198
},
146-
"execution_count": 6,
199+
"execution_count": 7,
147200
"metadata": {},
148201
"output_type": "execute_result"
149202
}

0 commit comments

Comments
 (0)