Skip to content

Commit 40fdd4f

Browse files
committed
DOC: More details about IPython config
1 parent fa9bbe4 commit 40fdd4f

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

doc/code-cells.ipynb

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@
284284
"The output formats for Matplotlib plots can be customized.\n",
285285
"You'll need separate settings for the Jupyter Notebook application and for `nbsphinx`.\n",
286286
"\n",
287-
"If you want to use SVG images for Matplotlib plots, add this line to your IPython configuration file in your profile directory\n",
288-
"(typically `~/.ipython/profile_default/ipython_kernel_config.py`):\n",
287+
"If you want to use SVG images for Matplotlib plots,\n",
288+
"add this line to your IPython configuration file:\n",
289289
"\n",
290290
"```python\n",
291291
"c.InlineBackend.figure_formats = {'svg'}\n",
@@ -297,7 +297,8 @@
297297
"c.InlineBackend.figure_formats = {'svg', 'pdf'}\n",
298298
"```\n",
299299
"\n",
300-
"If you want to use the default PNG plots or HiDPI plots using `'retina'`, make sure to set this:\n",
300+
"If you want to use the default PNG plots or HiDPI plots using `'png2x'` (a.k.a. `'retina'`),\n",
301+
"make sure to set this:\n",
301302
"\n",
302303
"```python\n",
303304
"c.InlineBackend.rc = {'figure.dpi': 96}\n",
@@ -306,13 +307,25 @@
306307
"This is needed because the default `'figure.dpi'` value of 72\n",
307308
"is only valid for the [Qt Console](https://qtconsole.readthedocs.io/).\n",
308309
"\n",
310+
"If you are planning to store your SVG plots as part of your notebooks,\n",
311+
"you should also have a look at the `'svg.hashsalt'` setting.\n",
312+
"\n",
313+
"For more details on these and other settings, have a look at\n",
314+
"[Default Values for Matplotlib's \"inline\" Backend](http://nbviewer.jupyter.org/github/mgeier/python-audio/blob/master/plotting/matplotlib-inline-defaults.ipynb).\n",
315+
"\n",
316+
"The configuration file `ipython_kernel_config.py` can be either\n",
317+
"in the directory where your notebook is located\n",
318+
"(see the [ipython_kernel_config.py](ipython_kernel_config.py) in this directory),\n",
319+
"or in your profile directory\n",
320+
"(typically `~/.ipython/profile_default/ipython_kernel_config.py`).\n",
309321
"If you don't know your IPython profile directory, use this command:\n",
310322
"\n",
311323
" python3 -m IPython profile locate\n",
312324
"\n",
313-
"If you want to make this work on https://mybinder.org/,\n",
314-
"just create a file with those settings in a file named\n",
315-
"[.ipython/profile_default/ipython_kernel_config.py](../.ipython/profile_default/ipython_kernel_config.py) in your repository.\n",
325+
"A local `ipython_kernel_config.py` in the notebook directory\n",
326+
"also works on https://mybinder.org/.\n",
327+
"Alternatively, you can create a file with those settings in a file named\n",
328+
"`.ipython/profile_default/ipython_kernel_config.py` in your repository.\n",
316329
"\n",
317330
"To get SVG and PDF plots for `nbsphinx`,\n",
318331
"use something like this in your `conf.py` file:\n",
@@ -379,7 +392,9 @@
379392
"cell_type": "markdown",
380393
"metadata": {},
381394
"source": [
382-
"If you want to use PNG images, but with HiDPI resolution, use the special `'retina'` format (which also looks nice in the LaTeX output):"
395+
"If you want to use PNG images, but with HiDPI resolution,\n",
396+
"use the special `'png2x'` (a.k.a. `'retina'`) format\n",
397+
"(which also looks nice in the LaTeX output):"
383398
]
384399
},
385400
{
@@ -388,7 +403,7 @@
388403
"metadata": {},
389404
"outputs": [],
390405
"source": [
391-
"%config InlineBackend.figure_formats = ['retina']"
406+
"%config InlineBackend.figure_formats = ['png2x']"
392407
]
393408
},
394409
{
File renamed without changes.

0 commit comments

Comments
 (0)