Skip to content

Commit b10fdb7

Browse files
authored
Merge pull request #515 from ianhi/docfix
update `ioff` usage in docs
2 parents 31ae91d + 2e2c5d4 commit b10fdb7

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

docs/examples/full-example.ipynb

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
"\n",
273273
"If we make sure interactive mode is off when we create the figure then the figure will only display where we want it to.\n",
274274
"\n",
275-
"There is ongoing work to allow usage of `ioff` as a context manager, see the [ipympl issue](https://github.com/matplotlib/ipympl/issues/220) and the [matplotlib issue](https://github.com/matplotlib/matplotlib/issues/17013)"
275+
"To do this you can use `plt.ioff()` as a context manager."
276276
]
277277
},
278278
{
@@ -281,9 +281,8 @@
281281
"metadata": {},
282282
"outputs": [],
283283
"source": [
284-
"plt.ioff()\n",
285-
"fig = plt.figure()\n",
286-
"plt.ion()\n",
284+
"with plt.ioff():\n",
285+
" fig = plt.figure()\n",
287286
"\n",
288287
"ax = fig.gca()\n",
289288
"ax.imshow(Z)\n",
@@ -301,7 +300,7 @@
301300
"source": [
302301
"# Interacting with other widgets\n",
303302
"\n",
304-
"## Changing a line plot with a slide"
303+
"## Changing a line plot with a slider"
305304
]
306305
},
307306
{
@@ -385,9 +384,8 @@
385384
"metadata": {},
386385
"outputs": [],
387386
"source": [
388-
"plt.ioff()\n",
389-
"fig = plt.figure()\n",
390-
"plt.ion()\n",
387+
"with plt.ioff():\n",
388+
" fig = plt.figure()\n",
391389
"im = plt.imshow(example_image_stack[0])\n",
392390
"\n",
393391
"def update(change):\n",
@@ -425,9 +423,8 @@
425423
"metadata": {},
426424
"outputs": [],
427425
"source": [
428-
"plt.ioff()\n",
429-
"fig = plt.figure()\n",
430-
"plt.ion()\n",
426+
"with plt.ioff():\n",
427+
" fig = plt.figure()\n",
431428
"im = plt.imshow(example_image_stack[0])\n",
432429
"\n",
433430
"out = widgets.Output()\n",
@@ -448,7 +445,7 @@
448445
],
449446
"metadata": {
450447
"kernelspec": {
451-
"display_name": "Python 3",
448+
"display_name": "Python 3 (ipykernel)",
452449
"language": "python",
453450
"name": "python3"
454451
},
@@ -462,7 +459,7 @@
462459
"name": "python",
463460
"nbconvert_exporter": "python",
464461
"pygments_lexer": "ipython3",
465-
"version": "3.8.6"
462+
"version": "3.11.0"
466463
},
467464
"widgets": {
468465
"application/vnd.jupyter.widget-state+json": {

0 commit comments

Comments
 (0)