From: <md...@us...> - 2008-09-30 20:08:13
|
Revision: 6137 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6137&view=rev Author: mdboom Date: 2008-09-30 20:07:54 +0000 (Tue, 30 Sep 2008) Log Message: ----------- [ 2138392 ] API doc for add_subplot() Also fixing numerous problems with the documentation build. It seems that the change in plot_directive.py to use the "code" module to run scripts interferes with i18n in Sphinx (due to the overloading of '_' as a symbol). Changed to use the fewer-moving-parts imp.load_module() instead. Modified Paths: -------------- trunk/matplotlib/doc/faq/howto_faq.rst trunk/matplotlib/doc/make.py trunk/matplotlib/doc/sphinxext/plot_directive.py trunk/matplotlib/examples/pylab_examples/findobj_demo.py trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/doc/faq/howto_faq.rst =================================================================== --- trunk/matplotlib/doc/faq/howto_faq.rst 2008-09-30 17:29:03 UTC (rev 6136) +++ trunk/matplotlib/doc/faq/howto_faq.rst 2008-09-30 20:07:54 UTC (rev 6137) @@ -117,7 +117,7 @@ How do I automatically make room for my tick labels? ==================================================== -In most use cases, it is enought to simpy change the subplots adjust +In most use cases, it is enough to simpy change the subplots adjust parameters as described in :ref:`howto-subplots-adjust`. But in some cases, you don't know ahead of time what your tick labels will be, or how large they will be (data and labels outside your control may be Modified: trunk/matplotlib/doc/make.py =================================================================== --- trunk/matplotlib/doc/make.py 2008-09-30 17:29:03 UTC (rev 6136) +++ trunk/matplotlib/doc/make.py 2008-09-30 20:07:54 UTC (rev 6137) @@ -85,7 +85,7 @@ for arg in sys.argv[1:]: func = funcd.get(arg) if func is None: - raise SystemExit('Do not know how to handle %s; valid args are'%( + raise SystemExit('Do not know how to handle %s; valid args are %s'%( arg, funcd.keys())) func() else: Modified: trunk/matplotlib/doc/sphinxext/plot_directive.py =================================================================== --- trunk/matplotlib/doc/sphinxext/plot_directive.py 2008-09-30 17:29:03 UTC (rev 6136) +++ trunk/matplotlib/doc/sphinxext/plot_directive.py 2008-09-30 20:07:54 UTC (rev 6137) @@ -13,7 +13,7 @@ source will be included inline, as well as a link to the source. """ -import sys, os, glob, shutil, code +import sys, os, glob, shutil, imp from docutils.parsers.rst import directives try: @@ -30,12 +30,10 @@ matplotlib.use('Agg') import matplotlib.pyplot as plt -#import IPython.Shell -#mplshell = IPython.Shell.MatplotlibShell('mpl') -console = code.InteractiveConsole() def runfile(fname): - source = file(fname).read() - return console.runsource(source) + fd = open(fname) + module = imp.load_module("__main__", fd, fname, ('py', 'r', imp.PY_SOURCE)) + return module options = {'alt': directives.unchanged, 'height': directives.length_or_unitless, Modified: trunk/matplotlib/examples/pylab_examples/findobj_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/findobj_demo.py 2008-09-30 17:29:03 UTC (rev 6136) +++ trunk/matplotlib/examples/pylab_examples/findobj_demo.py 2008-09-30 20:07:54 UTC (rev 6137) @@ -1,5 +1,5 @@ """ -Recursuvely find all objects that match some criteria +Recursively find all objects that match some criteria """ import numpy as np import matplotlib.pyplot as plt Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2008-09-30 17:29:03 UTC (rev 6136) +++ trunk/matplotlib/lib/matplotlib/figure.py 2008-09-30 20:07:54 UTC (rev 6137) @@ -633,21 +633,23 @@ fig.add_subplot(111, polar=True) # add a polar subplot fig.add_subplot(sub) # add Subplot instance sub - *kwargs* are legal :class:`!matplotlib.axes.Axes` kwargs plus *projection*, which chooses - a projection type for the axes. (For backward compatibility, - *polar=True* may also be provided, which is equivalent to - *projection='polar'*). Valid values for *projection* are: %s. - Some of these projections support additional *kwargs*, which may - be provided to :meth:`add_axes`. + *kwargs* are legal :class:`!matplotlib.axes.Axes` kwargs plus + *projection*, which chooses a projection type for the axes. + (For backward compatibility, *polar=True* may also be + provided, which is equivalent to *projection='polar'*). Valid + values for *projection* are: %s. Some of these projections + support additional *kwargs*, which may be provided to + :meth:`add_axes`. The :class:`~matplotlib.axes.Axes` instance will be returned. - If the figure already has a subplot with key *args*, *kwargs* then it will - simply make that subplot current and return it + If the figure already has a subplot with key (*args*, + *kwargs*) then it will simply make that subplot current and + return it. The following kwargs are supported: %s - """ % (", ".join(get_projection_names()), "%(Axes)s") + """ key = self._make_key(*args, **kwargs) if self._seen.has_key(key): @@ -680,7 +682,8 @@ self.sca(a) self._seen[key] = a return a - add_subplot.__doc__ = dedent(add_subplot.__doc__) % artist.kwdocd + add_subplot.__doc__ = dedent(add_subplot.__doc__) % ( + ", ".join(get_projection_names()), "%(Axes)s") % artist.kwdocd def clf(self): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |