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

Skip to content

Commit 7b7265e

Browse files
committed
keep static figures with dynamically generated ones, but commit the
figures to svn so they will not be auto-generated. This way we can be consistent in the way we include figures using the plot directive svn path=/trunk/matplotlib/; revision=5521
1 parent 1f8cbbd commit 7b7265e

19 files changed

Lines changed: 391 additions & 109 deletions
-53.9 KB
Binary file not shown.

doc/_static/tex_unicode_demo.png

-22.6 KB
Binary file not shown.

doc/devel/documenting_mpl.rst

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,17 @@ present the contents of the file, marked up as source code.
126126
Static figures
127127
--------------
128128

129-
Any figures that rely on optional system configurations should be generated
130-
with a script residing in doc/static_figs. The resulting figures will be saved
131-
to doc/_static, and will be named based on the name of the script, so we can
132-
avoid unintentionally overwriting any existing figures. Please run the
133-
:file:`doc/static_figs/make.py` file when adding additional figures, and commit
134-
the script **and** the images to svn. Please also add a line to
135-
the README in doc/static-figs for any additional requirements necessary to
136-
generate a new figure. These figures are not to be generated during the
137-
documentation build. Please use something like the following to include the
138-
source code and the image::
139-
140-
.. literalinclude:: ../mpl_examples/pylab_examples/tex_unicode_demo.py
141-
142-
.. image:: ../_static/tex_unicode_demo.png
129+
Any figures that rely on optional system configurations need to be handled a
130+
little differently. These figures are not to be generated during the
131+
documentation build, in order to keep the prerequisites to the documentation
132+
effort as low as possible. Please run the :file:`doc/pyplots/make.py` script
133+
when adding such figures, and commit the script **and** the images to
134+
svn. Please also add a line to the README in doc/pyplots for any additional
135+
requirements necessary to generate a new figure. Once these steps have been
136+
taken, these figures can be included in the usual way::
137+
138+
.. plot:: tex_unicode_demo.py
139+
:include-source
143140

144141

145142

doc/pyplots/README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Please add a line to this file for any additional requirements necessary to
2+
generate a new figure.
3+
4+
tex_demo.py and tex_unicode_demo.py:
5+
latex
6+
dvipng

doc/pyplots/make.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ def figs():
1515
print 'making figs'
1616
import matplotlib.pyplot as plt
1717
for fname in glob.glob('*.py'):
18-
if fname==__file__: continue
18+
if fname.split('/')[-1] == __file__.split('/')[-1]: continue
1919
basename, ext = os.path.splitext(fname)
20-
imagefiles = dict([('../_static/%s.%s'%(basename, format), dpi)
20+
imagefiles = dict([('%s.%s'%(basename, format), dpi)
2121
for format, dpi in formats])
2222
all_exists = True
2323
for imagefile in imagefiles:

doc/pyplots/matplotlibrc

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

doc/pyplots/tex_demo.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from matplotlib import rc
2+
from numpy import arange, cos, pi
3+
from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
4+
grid, savefig, show
5+
6+
7+
rc('text', usetex=True)
8+
rc('font', family='serif')
9+
figure(1, figsize=(6,4))
10+
ax = axes([0.1, 0.1, 0.8, 0.7])
11+
t = arange(0.0, 1.0+0.01, 0.01)
12+
s = cos(2*2*pi*t)+2
13+
plot(t, s)
14+
15+
xlabel(r'\textbf{time (s)}')
16+
ylabel(r'\textit{voltage (mV)}',fontsize=16)
17+
title(r"\TeX\ is Number $\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
18+
fontsize=16, color='r')
19+
grid(True)

0 commit comments

Comments
 (0)