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

Skip to content

Commit 5d3cdb7

Browse files
committed
added script to autogenerate example files
svn path=/trunk/matplotlib/; revision=6225
1 parent 88f661c commit 5d3cdb7

7 files changed

Lines changed: 112 additions & 19 deletions

File tree

doc/_templates/index.html

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
{% block body %}
66
<h1>Welcome</h1>
77

8-
matplotlib is a python 2D plotting library which produces
8+
<p>matplotlib is a python 2D plotting library which produces
99
publication quality figures in a variety of hardcopy formats and
1010
interactive environments across platforms. matplotlib can be used
1111
in python scripts, the python and <a
1212
href=http://ipython.scipy.org>ipython</a> shell (ala matlab or
1313
mathematica), web application servers, and six graphical user
14-
interface toolkits. <p>
14+
interface toolkits.</p>
1515

16-
matplotlib tries to make easy things easy and hard things possible.
16+
<p>matplotlib tries to make easy things easy and hard things possible.
1717
You can generate plots, histograms, power spectra, bar charts,
1818
errorcharts, scatterplots, etc, with just a few lines of code. For
1919
example, to generate 10,000 gaussian random numbers and make a
@@ -22,19 +22,20 @@ <h1>Welcome</h1>
2222
<pre>
2323
>>> from pylab import randn, hist
2424
>>> x = randn(10000)
25-
>>> hist(x, 100)
26-
</pre>
25+
>>> hist(x, 100)</pre>
2726

2827
For the power user, you have full control of line styles, font
2928
properties, axes properties, etc, via an object oriented interface
30-
or via a handle graphics interface familiar to Matlab&reg; users.
29+
or via a handle graphics interface familiar to Matlab&reg; users.</p>
3130

32-
The plotting functions in the <a href=api/pyplot_api.html>pyplot</a>
33-
interface have a high degree of Matlab&reg; compatibility.<p>
31+
<p>The plotting functions in the <a href=api/pyplot_api.html>pyplot</a>
32+
interface have a high degree of Matlab&reg; compatibility.</p>
33+
34+
<h3>Plotting commands</h3>
35+
<br>
3436

35-
<br>
3637
<table border=1 cellpadding=3 cellspacing=2>
37-
<caption><h3>Plotting commands</h3></caption>
38+
3839
<tr><th>Function</th><th>Description</th></tr>
3940
<tr>
4041
<th align="left">

doc/_templates/indexsidebar.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,22 @@ <h3>Download</h3>
1212
</p>
1313

1414
<h3>Need help?</h3>
15+
<<<<<<< .mine
16+
<<<<<<< .mine
17+
<p>Check the <a href="{{ pathto('contents') }}"}>docs</a>,
18+
the <a href="{{ pathto('faq/index') }}">faq</a>, and join the
19+
matplotlib
20+
mailing <a href="http://sourceforge.net/project/showfiles.php?group_id=80706">lists</a>.
21+
There is a also community wiki <a href=http://www.scipy.org/Cookbook/Matplotlib>cookbook</a></p>
22+
=======
23+
<p>Check the <a href="{{ pathto('users/index') }}"}>user</a> guide, the <a
24+
=======
1525
<p>Check the <a href="{{ pathto('users/index') }}">user</a> guide, the <a
26+
>>>>>>> .r6222
1627
href="{{ pathto('faq/index') }}">faq</a>, the <a href="{{
1728
pathto('api/index') }}"}>api</a> docs, <a href=http://www.nabble.com/matplotlib---users-f2906.html>archives</a>, and join the matplotlib mailing <a
1829
href="http://sourceforge.net/mail/?group_id=80706">lists</a>
30+
>>>>>>> .r6221
1931

2032
<p>You can file bugs, patches and feature requests on the sourceforge <a href="http://sourceforge.net/tracker2/?group_id=80706">tracker</a>, but it is a good idea to ping us on the mailing list too.</p>
2133

doc/examples/gen_rst.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
"""
2+
generate the rst files for the examples by iterating over the pylab examples
3+
"""
4+
import os, glob
5+
6+
import matplotlib.cbook as cbook
7+
8+
9+
import os
10+
import sys
11+
fileList = []
12+
rootdir = '../mpl_examples'
13+
14+
datad = {}
15+
for root, subFolders, files in os.walk(rootdir):
16+
for fname in files:
17+
if ( fname.startswith('.') or fname.startswith('#') or
18+
fname.find('.svn')>=0 or not fname.endswith('.py') ):
19+
continue
20+
21+
fullpath = os.path.join(root,fname)
22+
contents = file(fullpath).read()
23+
# indent
24+
contents = '\n'.join([' %s'%row.rstrip() for row in contents.split('\n')])
25+
relpath = os.path.split(root)[-1]
26+
datad.setdefault(relpath, []).append((fname, contents))
27+
28+
subdirs = datad.keys()
29+
subdirs.sort()
30+
31+
fhindex = file('index.rst')
32+
fh.index.write("""\
33+
.. _examples-index:
34+
35+
####################
36+
Matplotlib Examples
37+
###################
38+
39+
.. htmlonly::
40+
41+
:Release: |version|
42+
:Date: |today|
43+
44+
.. toctree::
45+
:maxdepth: 2
46+
47+
""")
48+
49+
for subdir in subdirs:
50+
print subdir
51+
outfile = '%s.rst'%subdir
52+
fh = file(outfile, 'w')
53+
54+
fhindex.write(' %s\n'%outfile)
55+
56+
fh.write('.. _%s-examples:\n\n'%subdir)
57+
title = '%s examples'%subdir
58+
59+
fh.write('*'*len(title) + '\n')
60+
fh.write(title + '\n')
61+
fh.write('*'*len(title) + '\n\n')
62+
63+
for fname, contents in datad[subdir]:
64+
print ' ', fname
65+
basename, ext = os.path.splitext(fname)
66+
fh.write('.. _%s-example:\n\n'%basename)
67+
title = '%s example'%basename
68+
69+
fh.write(title + '\n')
70+
fh.write('='*len(title) + '\n\n')
71+
fh.write(fname + '::\n\n')
72+
fh.write(contents)
73+
fh.write('\n\n')
74+
fh.close()
75+
76+
77+
78+
fhindex.close()

doc/faq/installing_faq.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
.. _installing-faq:
22

3-
*************
4-
Installation
5-
*************
3+
*****************
4+
Installation FAQ
5+
*****************
6+
67

78
.. contents::
89

doc/make.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ def check_build():
1717
def sf():
1818
'push a copy to the sf site'
1919
os.system('cd build/html; rsync -avz . jdh2358,[email protected]:/home/groups/m/ma/matplotlib/htdocs/ -essh')
20+
os.system('cd ~/mpl/examples; svn-clean; cd ..; rsync -avz examples jdh2358,[email protected]:/home/groups/m/ma/matplotlib/htdocs/ -essh --cvs-exclude --delete')
2021

2122
def sfpdf():
2223
'push a copy to the sf site'
23-
os.system('cd build/latex; scp Matplotlib.pdf [email protected]:/home/groups/m/ma/matplotlib/htdocs/')
24+
os.system('cd build/latex; scp Matplotlib.pdf jdh2358,matplotlib@web.sf.net:/home/groups/m/ma/matplotlib/htdocs/')
2425

2526
def figs():
2627
os.system('cd users/figures/ && python make.py')

doc/users/installing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ matplotlib requires numpy version 1.1 or later. Although it is not a
4545
requirement to use matplotlib, we strongly encourage you to install
4646
`ipython <http://ipython.scipy.org/dist>`_, which is an interactive
4747
shell for python that is matplotlib aware. Once you have ipython,
48-
numpy and matplotlib installed, ipython's "pylab" mode you have a
48+
numpy and matplotlib installed, in ipython's "pylab" mode you have a
4949
matlab-like environment that automatically handles most of the
5050
configuration details for you, so you can get up and running quickly::
5151

@@ -83,7 +83,7 @@ Installing from source
8383

8484
If you are interested perhaps in contributing to matplotlib
8585
development, or just like to build everything yourself, it is not
86-
difficult to build matplotlib from source. Grab the lattest *tar.gz*
86+
difficult to build matplotlib from source. Grab the latest *tar.gz*
8787
release file from `sourceforge
8888
<http://sourceforge.net/project/showfiles.php?group_id=80706>`_, or if
8989
you want to develop matplotlib or just need the latest bugfixed

doc/users/toolkits.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ Excel. This toolkit ships with matplotlib, but requires
3535

3636
.. _toolkit_natgrid:
3737

38-
Natrgrid
38+
Natgrid
3939
========
40-
40+
4141
mpl_toolkits.natgrid is an interface to natgrid C library for gridding
4242
irregularly spaced data. This requires a separate installation of the
4343
natgrid toolkit from the sourceforge `download
4444
<http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=142792>`_
4545
page.
46-
46+

0 commit comments

Comments
 (0)