|
284 | 284 | "The output formats for Matplotlib plots can be customized.\n", |
285 | 285 | "You'll need separate settings for the Jupyter Notebook application and for `nbsphinx`.\n", |
286 | 286 | "\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", |
289 | 289 | "\n", |
290 | 290 | "```python\n", |
291 | 291 | "c.InlineBackend.figure_formats = {'svg'}\n", |
|
297 | 297 | "c.InlineBackend.figure_formats = {'svg', 'pdf'}\n", |
298 | 298 | "```\n", |
299 | 299 | "\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", |
301 | 302 | "\n", |
302 | 303 | "```python\n", |
303 | 304 | "c.InlineBackend.rc = {'figure.dpi': 96}\n", |
|
306 | 307 | "This is needed because the default `'figure.dpi'` value of 72\n", |
307 | 308 | "is only valid for the [Qt Console](https://qtconsole.readthedocs.io/).\n", |
308 | 309 | "\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", |
309 | 321 | "If you don't know your IPython profile directory, use this command:\n", |
310 | 322 | "\n", |
311 | 323 | " python3 -m IPython profile locate\n", |
312 | 324 | "\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", |
316 | 329 | "\n", |
317 | 330 | "To get SVG and PDF plots for `nbsphinx`,\n", |
318 | 331 | "use something like this in your `conf.py` file:\n", |
|
379 | 392 | "cell_type": "markdown", |
380 | 393 | "metadata": {}, |
381 | 394 | "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):" |
383 | 398 | ] |
384 | 399 | }, |
385 | 400 | { |
|
388 | 403 | "metadata": {}, |
389 | 404 | "outputs": [], |
390 | 405 | "source": [ |
391 | | - "%config InlineBackend.figure_formats = ['retina']" |
| 406 | + "%config InlineBackend.figure_formats = ['png2x']" |
392 | 407 | ] |
393 | 408 | }, |
394 | 409 | { |
|
0 commit comments