@@ -271,25 +271,40 @@ Referring to mpl documents
271271==========================
272272
273273In the documentation, you may want to include to a document in the
274- matplotlib src, e.g. a license file, an image file from `mpl-data `, or an
275- example. When you include these files, include them using a symbolic
276- link from the documentation parent directory. This way, if we
277- relocate the mpl documentation directory, all of the internal pointers
278- to files will not have to change, just the top level symlinks. For
279- example, In the top level doc directory we have symlinks pointing to
280- the mpl `examples ` and `mpl-data `::
281-
282- home:~/mpl/doc2> ls -l mpl_*
283- mpl_data -> ../lib/matplotlib/mpl-data
284- mpl_examples -> ../examples
274+ matplotlib src, e.g. a license file or an image file from `mpl-data `,
275+ refer to it via a relative path from the document where the rst file
276+ resides, eg, in :file: `users/navigation_toolbar.rst `, we refer to the
277+ image icons with::
285278
279+ .. image:: ../../lib/matplotlib/mpl-data/images/subplots.png
286280
287281In the `users ` subdirectory, if I want to refer to a file in the mpl-data
288282directory, I use the symlink directory. For example, from
289283`customizing.rst `::
290284
291- .. literalinclude:: ../mpl_data/matplotlibrc
285+ .. literalinclude:: ../../lib/matplotlib/mpl-data/matplotlibrc
286+
287+ On exception to this is when referring to the examples dir. Relative
288+ paths are extremely confusing in the sphinx plot extensions, so
289+ without getting into the dirty details, it is easier to simply include
290+ a symlink to the files at the top doc level directory. This way, API
291+ documents like :meth: `matplotlib.pyplot.plot ` can refer to the
292+ examples in a known location.
293+
294+ In the top level doc directory we have symlinks pointing to
295+ the mpl `examples `::
296+
297+ home:~/mpl/doc> ls -l mpl_*
298+ mpl_examples -> ../examples
299+
300+ So we can include plots from the examples dir using the symlink::
301+
302+ .. plot:: mpl_examples/pylab_examples/simple_plot.py
303+
292304
305+ We used to use a symlink for :file: `mpl-data ` too, but the distro
306+ becomes very large on platforms that do not support links (eg the font
307+ files are duplicated and large)
293308
294309.. _internal-section-refs :
295310
0 commit comments