From: <md...@us...> - 2008-06-20 15:24:31
|
Revision: 5616 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5616&view=rev Author: mdboom Date: 2008-06-20 08:24:16 -0700 (Fri, 20 Jun 2008) Log Message: ----------- Fix bug: [ 1978629 ] scale documentation missing/incorrect for log Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/pyplot.py trunk/matplotlib/lib/matplotlib/scale.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008-06-20 15:03:18 UTC (rev 5615) +++ trunk/matplotlib/CHANGELOG 2008-06-20 15:24:16 UTC (rev 5616) @@ -1,3 +1,5 @@ +2008-06-20 [ 1978629 ] scale documentation missing/incorrect for log - MGD + 2008-06-20 Added closed kwarg to PolyCollection. Fixes bug [ 1994535 ] still missing lines on graph with svn (r 5548). - MGD Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008-06-20 15:03:18 UTC (rev 5615) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008-06-20 15:24:16 UTC (rev 5616) @@ -1765,12 +1765,15 @@ Different kwargs are accepted, depending on the scale: %(scale_docs)s - """ % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]), - 'scale_docs': mscale.get_scale_docs().strip()} + """ self.xaxis.set_scale(value, **kwargs) self.autoscale_view() self._update_transScale() + set_xscale.__doc__ = cbook.dedent(set_xscale.__doc__) % { + 'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]), + 'scale_docs': mscale.get_scale_docs().strip()} + def get_xticks(self, minor=False): 'Return the x ticks as a list of locations' return self.xaxis.get_ticklocs(minor=minor) @@ -1929,12 +1932,15 @@ Different kwargs are accepted, depending on the scale: %(scale_docs)s - """ % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]), - 'scale_docs': mscale.get_scale_docs().strip()} + """ self.yaxis.set_scale(value, **kwargs) self.autoscale_view() self._update_transScale() + set_yscale.__doc__ = cbook.dedent(set_yscale.__doc__) % { + 'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]), + 'scale_docs': mscale.get_scale_docs().strip()} + def get_yticks(self, minor=False): 'Return the y ticks as a list of locations' return self.yaxis.get_ticklocs(minor=minor) Modified: trunk/matplotlib/lib/matplotlib/pyplot.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pyplot.py 2008-06-20 15:03:18 UTC (rev 5615) +++ trunk/matplotlib/lib/matplotlib/pyplot.py 2008-06-20 15:24:16 UTC (rev 5616) @@ -810,34 +810,44 @@ def xscale(*args, **kwargs): """ + call signature:: + + xscale(scale, **kwargs) + Set the scaling for the x-axis: %(scale)s Different keywords may be accepted, depending on the scale: %(scale_docs)s - """ % {'scale': ' | '.join([repr(x) for x in get_scale_names()]), - 'scale_docs': get_scale_docs()} + """ ax = gca() ret = ax.set_xscale(*args, **kwargs) draw_if_interactive() return ret +xscale.__doc__ = dedent(xscale.__doc__) % { + 'scale': ' | '.join([repr(x) for x in get_scale_names()]), + 'scale_docs': get_scale_docs()} - def yscale(*args, **kwargs): """ + call signature:: + + xscale(scale, **kwargs) + Set the scaling for the y-axis: %(scale)s Different keywords may be accepted, depending on the scale: %(scale_docs)s - """ % {'scale': ' | '.join([repr(x) for x in get_scale_names()]), - 'scale_docs': get_scale_docs()} + """ ax = gca() ret = ax.set_yscale(*args, **kwargs) draw_if_interactive() return ret +yscale.__doc__ = dedent(yscale.__doc__) % { + 'scale': ' | '.join([repr(x) for x in get_scale_names()]), + 'scale_docs': get_scale_docs()} - def xticks(*args, **kwargs): """ Set/Get the xlimits of the current ticklocs and labels:: Modified: trunk/matplotlib/lib/matplotlib/scale.py =================================================================== --- trunk/matplotlib/lib/matplotlib/scale.py 2008-06-20 15:03:18 UTC (rev 5615) +++ trunk/matplotlib/lib/matplotlib/scale.py 2008-06-20 15:24:16 UTC (rev 5616) @@ -172,10 +172,18 @@ def __init__(self, axis, **kwargs): """ - basex/basey: The base of the logarithm + *basex*/*basey*: + The base of the logarithm - subsx/subsy: The number of subticks to draw between each major - tick + *subsx*/*subsy*: + Where to place the subticks between each major tick. + Should be a sequence of integers. For example, in a log10 + scale:: + + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + will place 10 logarithmically spaced minor ticks between + each major tick. """ if axis.axis_name == 'x': base = kwargs.pop('basex', 10.0) @@ -273,14 +281,22 @@ def __init__(self, axis, **kwargs): """ - basex/basey: The base of the logarithm + *basex*/*basey*: + The base of the logarithm - linthreshx/linthreshy: The range (-x, x) within which the plot - is linear (to avoid having the plot go to infinity around - zero). + *linthreshx*/*linthreshy*: + The range (-*x*, *x*) within which the plot is linear (to + avoid having the plot go to infinity around zero). - subsx/subsy: The number of subticks to render between each - major tick. + *subsx*/*subsy*: + Where to place the subticks between each major tick. + Should be a sequence of integers. For example, in a log10 + scale:: + + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + will place 10 logarithmically spaced minor ticks between + each major tick. """ if axis.axis_name == 'x': base = kwargs.pop('basex', 10.0) @@ -340,9 +356,8 @@ scale_class = _scale_mapping[name] docs.append(" '%s'" % name) docs.append("") - class_docs = textwrap.wrap( - dedent(scale_class.__init__.__doc__), initial_indent=" " * 8, - subsequent_indent = " " * 8) - docs.extend(class_docs) + class_docs = dedent(scale_class.__init__.__doc__) + class_docs = "".join([" %s\n" % x for x in class_docs.split("\n")]) + docs.append(class_docs) docs.append("") return "\n".join(docs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |