Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ff4ca3b

Browse files
committed
updated documentation guide to include Mike's plot directive
svn path=/trunk/matplotlib/; revision=5510
1 parent b04880a commit ff4ca3b

1 file changed

Lines changed: 33 additions & 9 deletions

File tree

doc/devel/documenting_mpl.rst

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,16 @@ Formatting
5656
The Sphinx website contains plenty of documentation_ concerning ReST markup and
5757
working with Sphinx in general. Here are a few additional things to keep in mind:
5858

59+
* Please familiarize yourself with the Sphinx directives for `inline
60+
markup`_. Matplotlib's documentation makes heavy use of cross-referencing and
61+
other semantic markup. For example, when referring to external files, use the
62+
``:file:`` directive.
63+
5964
* Sphinx does not support tables with column- or row-spanning cells for
6065
latex output. Such tables can not be used when documenting matplotlib.
6166

62-
* Mathematical expressions can be rendered as png images in html, and in
63-
the usual way by latex. For example:
67+
* Mathematical expressions can be rendered as png images in html, and in the
68+
usual way by latex. For example:
6469

6570
``math:`sin(x_n^2)``` yields: :math:`sin(x_n^2)`, and::
6671

@@ -88,28 +93,47 @@ working with Sphinx in general. Here are a few additional things to keep in mind
8893
In [69]: lines = plot([1,2,3])
8994

9095
.. _documentation: http://sphinx.pocoo.org/contents.html
96+
.. _`inline markup`: http://sphinx.pocoo.org/markup/inline.html
9197

9298

9399
Figures
94100
=======
95101

102+
Dynamically generated figures
103+
-----------------------------
104+
96105
Each guide will have its own `figures/` directory for scripts to generate images
97-
to be included in the dcoumentation. It is not necessary to explicitly save
106+
to be included in the documentation. It is not necessary to explicitly save
98107
the figure in the script, a figure will be saved with the same name as the
99-
filename when the documentation is generated. For example, use::
108+
filename when the documentation is generated. Matplotlib includes a Sphinx
109+
extension for generating the images from the python script and including either
110+
a png copy for html or a pdf for latex::
100111

101-
.. literalinclude:: figures/pyplot_simple.py
112+
.. plot:: figures/pyplot_simple
113+
:scale: 75
114+
:include-source:
102115

103-
.. image:: figures/pyplot_simple.png
104-
:scale: 75
116+
The ``:scale:`` directive rescales the image to some percentage of the original
117+
size. ``:include-source:`` will present the contents of the file, marked up as
118+
source code.
105119

120+
Static figures
121+
--------------
106122

107123
Any figures that rely on optional system configurations should be generated
108124
with a script residing in doc/static_figs. The resulting figures will be saved
109125
to doc/_static, and will be named based on the name of the script, so we can
110-
avoid unintentionally overwriting any existing figures. Please add a line to
126+
avoid unintentionally overwriting any existing figures. Please run the
127+
:file:`doc/static_figs/make.py` file when adding additional figures, and commit
128+
the script **and** the images to svn. Please also add a line to
111129
the README in doc/static-figs for any additional requirements necessary to
112-
generate a new figure.
130+
generate a new figure. These figures are not to be generated during the
131+
documentation build. Please use something like the following to include the
132+
source code and the image::
133+
134+
.. literalinclude:: ../mpl_examples/pylab_examples/tex_unicode_demo.py
135+
136+
.. image:: ../_static/tex_unicode_demo.png
113137

114138

115139

0 commit comments

Comments
 (0)