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

Skip to content

Commit 41c52a2

Browse files
committed
moved figure autogen into plot directive
svn path=/trunk/matplotlib/; revision=5513
1 parent ff4ca3b commit 41c52a2

27 files changed

Lines changed: 420 additions & 44 deletions

doc/devel/documenting_mpl.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,19 @@ Figures
102102
Dynamically generated figures
103103
-----------------------------
104104

105-
Each guide will have its own `figures/` directory for scripts to generate images
106-
to be included in the documentation. It is not necessary to explicitly save
107-
the figure in the script, a figure will be saved with the same name as the
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::
111-
112-
.. plot:: figures/pyplot_simple
105+
The top level :file:`doc` dir has a folder called :file:`pyplots` in
106+
which you should include any pyplot plotting scripts that you want to
107+
generate figures for the documentation. It is not necessary to
108+
explicitly save the figure in the script, this will be done
109+
automatically at build time to insure that the code that is included
110+
runs and produces the advertised figure. Several figures will be
111+
saved with the same basnename as the filename when the documentation
112+
is generated (low and high res PNGs, a PDF). Matplotlib includes a
113+
Sphinx extension (file:`sphinxext/plot_directive.py`) for generating
114+
the images from the python script and including either a png copy for
115+
html or a pdf for latex::
116+
117+
.. plot:: pyplot_simple.py
113118
:scale: 75
114119
:include-source:
115120

doc/make.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ def figs():
2323

2424
def html():
2525
check_build()
26-
figs()
26+
#figs()
2727
if os.system('sphinx-build -b html -d build/doctrees . build/html'):
2828
raise SystemExit("Building HTML failed.")
2929

30-
figures_dest_path = 'build/html/users/figures'
30+
figures_dest_path = 'build/html/pyplots'
3131
if os.path.exists(figures_dest_path):
3232
shutil.rmtree(figures_dest_path)
33-
shutil.copytree('users/figures', figures_dest_path)
33+
shutil.copytree('pyplots', figures_dest_path)
3434

3535
def latex():
3636
check_build()
37-
figs()
37+
#figs()
3838
if sys.platform != 'win32':
3939
# LaTeX format.
4040
if os.system('sphinx-build -b latex -d build/doctrees . build/latex'):
@@ -57,9 +57,11 @@ def latex():
5757

5858
def clean():
5959
shutil.rmtree('build')
60+
for fname in glob.glob('pyplots/*.png') + glob.glob('pyplots/*.pdf'):
61+
os.remove(fname)
6062

6163
def all():
62-
figs()
64+
#figs()
6365
html()
6466
latex()
6567

doc/matplotlibrc

Lines changed: 315 additions & 0 deletions
Large diffs are not rendered by default.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)