Revision: 5515
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5515&view=rev
Author: dsdale
Date: 2008-06-13 12:12:08 -0700 (Fri, 13 Jun 2008)
Log Message:
-----------
don't link to example scripts to generate documentation figures
Modified Paths:
--------------
trunk/matplotlib/doc/devel/documenting_mpl.rst
trunk/matplotlib/doc/pyplots/make.py
trunk/matplotlib/doc/static_figs/make.py
Added Paths:
-----------
trunk/matplotlib/doc/static_figs/tex_demo.py
trunk/matplotlib/doc/static_figs/tex_unicode_demo.py
Removed Paths:
-------------
trunk/matplotlib/doc/static_figs/tex_demo.png
trunk/matplotlib/doc/static_figs/tex_demo.py
trunk/matplotlib/doc/static_figs/tex_unicode_demo.py
Modified: trunk/matplotlib/doc/devel/documenting_mpl.rst
===================================================================
--- trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-06-13 17:45:22 UTC
(rev 5514)
+++ trunk/matplotlib/doc/devel/documenting_mpl.rst 2008-06-13 19:12:08 UTC
(rev 5515)
@@ -110,7 +110,7 @@
runs and produces the advertised figure. Several figures will be
saved with the same basnename as the filename when the documentation
is generated (low and high res PNGs, a PDF). Matplotlib includes a
-Sphinx extension (file:`sphinxext/plot_directive.py`) for generating
+Sphinx extension (:file:`sphinxext/plot_directive.py`) for generating
the images from the python script and including either a png copy for
html or a pdf for latex::
Modified: trunk/matplotlib/doc/pyplots/make.py
===================================================================
--- trunk/matplotlib/doc/pyplots/make.py 2008-06-13 17:45:22 UTC (rev
5514)
+++ trunk/matplotlib/doc/pyplots/make.py 2008-06-13 19:12:08 UTC (rev
5515)
@@ -17,10 +17,11 @@
for fname in glob.glob('*.py'):
if fname==__file__: continue
basename, ext = os.path.splitext(fname)
- outfiles = ['%s.%s' % (basename, format) for format, dpi in formats]
+ imagefiles = dict([('../_static/%s.%s'%(basename, format), dpi)
+ for format, dpi in formats])
all_exists = True
- for format, dpi in formats:
- if not os.path.exists('%s.%s' % (basename, format)):
+ for imagefile in imagefiles:
+ if not os.path.exists(imagefile):
all_exists = False
break
@@ -30,8 +31,8 @@
print ' building %s'%fname
plt.close('all') # we need to clear between runs
mplshell.magic_run(basename)
- for format, dpi in formats:
- plt.savefig('%s.%s' % (basename, format), dpi=dpi)
+ for imagefile, dpi in imagefiles.iteritems():
+ plt.savefig(imagefile, dpi=dpi)
print 'all figures made'
Modified: trunk/matplotlib/doc/static_figs/make.py
===================================================================
--- trunk/matplotlib/doc/static_figs/make.py 2008-06-13 17:45:22 UTC (rev
5514)
+++ trunk/matplotlib/doc/static_figs/make.py 2008-06-13 19:12:08 UTC (rev
5515)
@@ -2,32 +2,43 @@
import sys, os, glob
import matplotlib
import IPython.Shell
-matplotlib.rcdefaults()
+#matplotlib.rcdefaults()
matplotlib.use('Agg')
mplshell = IPython.Shell.MatplotlibShell('mpl')
+formats = [('png', 100),
+ ('hires.png', 200),
+ ('pdf', 72)]
+
def figs():
print 'making figs'
import matplotlib.pyplot as plt
for fname in glob.glob('*.py'):
if fname.split('/')[-1] == __file__.split('/')[-1]: continue
basename, ext = os.path.splitext(fname)
- outfile = '../_static/%s.png'%basename
+ imagefiles = dict([('../_static/%s.%s'%(basename, format), dpi)
+ for format, dpi in formats])
+ all_exists = True
+ for imagefile in imagefiles:
+ if not os.path.exists(imagefile):
+ all_exists = False
+ break
- if os.path.exists(outfile):
- print ' already have %s'%outfile
- continue
+ if all_exists:
+ print ' already have %s'%fname
else:
print ' building %s'%fname
- plt.close('all') # we need to clear between runs
- mplshell.magic_run(basename)
- plt.savefig(outfile)
+ plt.close('all') # we need to clear between runs
+ mplshell.magic_run(basename)
+ for imagefile, dpi in imagefiles.iteritems():
+ plt.savefig(imagefile, dpi=dpi)
print 'all figures made'
def clean():
- patterns = ['#*', '*~', '*.png', '*pyc']
+ patterns = (['#*', '*~', '*pyc'] +
+ ['*.%s' % format for format, dpi in formats])
for pattern in patterns:
for fname in glob.glob(pattern):
os.remove(fname)
Deleted: trunk/matplotlib/doc/static_figs/tex_demo.png
===================================================================
(Binary files differ)
Deleted: trunk/matplotlib/doc/static_figs/tex_demo.py
===================================================================
--- trunk/matplotlib/doc/static_figs/tex_demo.py 2008-06-13 17:45:22 UTC
(rev 5514)
+++ trunk/matplotlib/doc/static_figs/tex_demo.py 2008-06-13 19:12:08 UTC
(rev 5515)
@@ -1 +0,0 @@
-link ../mpl_examples/pylab_examples/tex_demo.py
\ No newline at end of file
Added: trunk/matplotlib/doc/static_figs/tex_demo.py
===================================================================
--- trunk/matplotlib/doc/static_figs/tex_demo.py
(rev 0)
+++ trunk/matplotlib/doc/static_figs/tex_demo.py 2008-06-13 19:12:08 UTC
(rev 5515)
@@ -0,0 +1,19 @@
+from matplotlib import rc
+from numpy import arange, cos, pi
+from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
+ grid, savefig, show
+
+
+rc('text', usetex=True)
+rc('font', family='serif')
+figure(1, figsize=(6,4))
+ax = axes([0.1, 0.1, 0.8, 0.7])
+t = arange(0.0, 1.0+0.01, 0.01)
+s = cos(2*2*pi*t)+2
+plot(t, s)
+
+xlabel(r'\textbf{time (s)}')
+ylabel(r'\textit{voltage (mV)}',fontsize=16)
+title(r"\TeX\ is Number
$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
+ fontsize=16, color='r')
+grid(True)
Property changes on: trunk/matplotlib/doc/static_figs/tex_demo.py
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: trunk/matplotlib/doc/static_figs/tex_unicode_demo.py
===================================================================
--- trunk/matplotlib/doc/static_figs/tex_unicode_demo.py 2008-06-13
17:45:22 UTC (rev 5514)
+++ trunk/matplotlib/doc/static_figs/tex_unicode_demo.py 2008-06-13
19:12:08 UTC (rev 5515)
@@ -1 +0,0 @@
-link ../mpl_examples/pylab_examples/tex_unicode_demo.py
\ No newline at end of file
Added: trunk/matplotlib/doc/static_figs/tex_unicode_demo.py
===================================================================
--- trunk/matplotlib/doc/static_figs/tex_unicode_demo.py
(rev 0)
+++ trunk/matplotlib/doc/static_figs/tex_unicode_demo.py 2008-06-13
19:12:08 UTC (rev 5515)
@@ -0,0 +1,19 @@
+# -*- coding: latin-1 -*-
+from matplotlib import rcParams
+rcParams['text.usetex']=True
+rcParams['text.latex.unicode']=True
+from numpy import arange, cos, pi
+from matplotlib.pyplot import figure, axes, plot, xlabel, ylabel, title, \
+ grid, savefig, show
+
+figure(1, figsize=(6,4))
+ax = axes([0.1, 0.1, 0.8, 0.7])
+t = arange(0.0, 1.0+0.01, 0.01)
+s = cos(2*2*pi*t)+2
+plot(t, s)
+
+xlabel(r'\textbf{time (s)}')
+ylabel(unicode(r'\textit{Velocity (\xB0/sec)}','latin-1'),fontsize=16)
+title(r"\TeX\ is Number
$\displaystyle\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}$!",
+ fontsize=16, color='r')
+grid(True)
Property changes on: trunk/matplotlib/doc/static_figs/tex_unicode_demo.py
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins