Skip to content

Commit c492f79

Browse files
committed
DOC: More details about IPython config
1 parent da9bf91 commit c492f79

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

doc/code-cells.jupyter

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ markdown
103103
The output formats for Matplotlib plots can be customized.
104104
You'll need separate settings for the Jupyter Notebook application and for `nbsphinx`.
105105

106-
If you want to use SVG images for Matplotlib plots, add this line to your IPython configuration file in your profile directory
107-
(typically `~/.ipython/profile_default/ipython_kernel_config.py`):
106+
If you want to use SVG images for Matplotlib plots,
107+
add this line to your IPython configuration file:
108108

109109
```python
110110
c.InlineBackend.figure_formats = {'svg'}
@@ -116,7 +116,8 @@ markdown
116116
c.InlineBackend.figure_formats = {'svg', 'pdf'}
117117
```
118118

119-
If you want to use the default PNG plots or HiDPI plots using `'retina'`, make sure to set this:
119+
If you want to use the default PNG plots or HiDPI plots using `'png2x'` (a.k.a. `'retina'`),
120+
make sure to set this:
120121

121122
```python
122123
c.InlineBackend.rc = {'figure.dpi': 96}
@@ -125,13 +126,25 @@ markdown
125126
This is needed because the default `'figure.dpi'` value of 72
126127
is only valid for the [Qt Console](https://qtconsole.readthedocs.io/).
127128

129+
If you are planning to store your SVG plots as part of your notebooks,
130+
you should also have a look at the `'svg.hashsalt'` setting.
131+
132+
For more details on these and other settings, have a look at
133+
[Default Values for Matplotlib's "inline" Backend](http://nbviewer.jupyter.org/github/mgeier/python-audio/blob/master/plotting/matplotlib-inline-defaults.ipynb).
134+
135+
The configuration file `ipython_kernel_config.py` can be either
136+
in the directory where your notebook is located
137+
(see the [ipython_kernel_config.py](ipython_kernel_config.py) in this directory),
138+
or in your profile directory
139+
(typically `~/.ipython/profile_default/ipython_kernel_config.py`).
128140
If you don't know your IPython profile directory, use this command:
129141

130142
python3 -m IPython profile locate
131143

132-
If you want to make this work on https://mybinder.org/,
133-
just create a file with those settings in a file named
134-
[.ipython/profile_default/ipython_kernel_config.py](../.ipython/profile_default/ipython_kernel_config.py) in your repository.
144+
A local `ipython_kernel_config.py` in the notebook directory
145+
also works on https://mybinder.org/.
146+
Alternatively, you can create a file with those settings in a file named
147+
`.ipython/profile_default/ipython_kernel_config.py` in your repository.
135148

136149
To get SVG and PDF plots for `nbsphinx`,
137150
use something like this in your `conf.py` file:
@@ -162,9 +175,11 @@ code
162175
code
163176
fig
164177
markdown
165-
If you want to use PNG images, but with HiDPI resolution, use the special `'retina'` format (which also looks nice in the LaTeX output):
178+
If you want to use PNG images, but with HiDPI resolution,
179+
use the special `'png2x'` (a.k.a. `'retina'`) format
180+
(which also looks nice in the LaTeX output):
166181
code
167-
%config InlineBackend.figure_formats = ['retina']
182+
%config InlineBackend.figure_formats = ['png2x']
168183
code
169184
fig
170185
markdown
File renamed without changes.

0 commit comments

Comments
 (0)