@@ -327,15 +327,14 @@ It is not necessary to explicitly save the figure from the script; this will be
327
327
done automatically when the docs are built to ensure that the code that is
328
328
included runs and produces the advertised figure.
329
329
330
- There are two options for where to put the code that generates a figure. If
331
- you want to include a plot in the examples gallery, the code should be added to
332
- the :file:`examples` directory. Plots from
333
- the :file:`examples` directory can then be referenced through the symlink
334
- ``mpl_examples`` in the ``doc`` directory, e.g.:
330
+ There are two options for where to put the code that generates a figure. If you
331
+ want to include a plot in the examples gallery, the code should be added to the
332
+ :file:`examples` directory. Plots from the :file:`examples` directory can then
333
+ be referenced through the ``gallery`` directory set up by sphinx-gallery ::
335
334
336
335
.. code-block:: rst
337
336
338
- .. plot:: mpl_examples /lines_bars_and_markers/fill.py
337
+ .. plot:: gallery /lines_bars_and_markers/fill.py
339
338
340
339
Alternatively the plotting code can be placed directly in the docstring.
341
340
To include plots directly in docstrings, see the following guide:
@@ -404,25 +403,12 @@ from :file:`customizing.rst`::
404
403
405
404
.. literalinclude:: ../../lib/matplotlib/mpl-data/matplotlibrc
406
405
407
- One exception to this is when referring to the examples directory. Relative
408
- paths are extremely confusing in the sphinx plot extensions, so it is easier
409
- to simply include a symlink to the files at the top doc level directory.
410
- This way, API documents like :meth:`matplotlib.pyplot.plot` can refer to the
411
- examples in a known location.
412
-
413
- In the top level :file:`doc` directory we have symlinks pointing to the
414
- Matplotlib :file:`examples`:
415
-
416
- .. code-block:: sh
417
-
418
- home:~/mpl/doc> ls -l mpl_*
419
- mpl_examples -> ../examples
420
-
421
- So we can include plots from the examples dir using the symlink:
406
+ The examples directory is also copied to :file:`doc/gallery` by sphinx-gallery,
407
+ so we can include plots from the examples dir using
422
408
423
409
.. code-block:: rst
424
410
425
- .. plot:: mpl_examples /pylab_examples/simple_plot.py
411
+ .. plot:: gallery /pylab_examples/simple_plot.py
426
412
427
413
.. _internal-section-refs:
428
414
0 commit comments