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

Skip to content

Commit 424adc1

Browse files
committed
Fix bug: [ 1978629 ] scale documentation missing/incorrect for log
svn path=/trunk/matplotlib/; revision=5616
1 parent 24cd510 commit 424adc1

4 files changed

Lines changed: 56 additions & 23 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2008-06-20 [ 1978629 ] scale documentation missing/incorrect for log - MGD
2+
13
2008-06-20 Added closed kwarg to PolyCollection. Fixes bug [ 1994535
24
] still missing lines on graph with svn (r 5548). - MGD
35

lib/matplotlib/axes.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,12 +1765,15 @@ def set_xscale(self, value, **kwargs):
17651765
17661766
Different kwargs are accepted, depending on the scale:
17671767
%(scale_docs)s
1768-
""" % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]),
1769-
'scale_docs': mscale.get_scale_docs().strip()}
1768+
"""
17701769
self.xaxis.set_scale(value, **kwargs)
17711770
self.autoscale_view()
17721771
self._update_transScale()
17731772

1773+
set_xscale.__doc__ = cbook.dedent(set_xscale.__doc__) % {
1774+
'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]),
1775+
'scale_docs': mscale.get_scale_docs().strip()}
1776+
17741777
def get_xticks(self, minor=False):
17751778
'Return the x ticks as a list of locations'
17761779
return self.xaxis.get_ticklocs(minor=minor)
@@ -1929,12 +1932,15 @@ def set_yscale(self, value, **kwargs):
19291932
19301933
Different kwargs are accepted, depending on the scale:
19311934
%(scale_docs)s
1932-
""" % {'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]),
1933-
'scale_docs': mscale.get_scale_docs().strip()}
1935+
"""
19341936
self.yaxis.set_scale(value, **kwargs)
19351937
self.autoscale_view()
19361938
self._update_transScale()
19371939

1940+
set_yscale.__doc__ = cbook.dedent(set_yscale.__doc__) % {
1941+
'scale': ' | '.join([repr(x) for x in mscale.get_scale_names()]),
1942+
'scale_docs': mscale.get_scale_docs().strip()}
1943+
19381944
def get_yticks(self, minor=False):
19391945
'Return the y ticks as a list of locations'
19401946
return self.yaxis.get_ticklocs(minor=minor)

lib/matplotlib/pyplot.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -810,33 +810,43 @@ def ylim(*args, **kwargs):
810810

811811
def xscale(*args, **kwargs):
812812
"""
813+
call signature::
814+
815+
xscale(scale, **kwargs)
816+
813817
Set the scaling for the x-axis: %(scale)s
814818
815819
Different keywords may be accepted, depending on the scale:
816820
817821
%(scale_docs)s
818-
""" % {'scale': ' | '.join([repr(x) for x in get_scale_names()]),
819-
'scale_docs': get_scale_docs()}
822+
"""
820823
ax = gca()
821824
ret = ax.set_xscale(*args, **kwargs)
822825
draw_if_interactive()
823826
return ret
824-
827+
xscale.__doc__ = dedent(xscale.__doc__) % {
828+
'scale': ' | '.join([repr(x) for x in get_scale_names()]),
829+
'scale_docs': get_scale_docs()}
825830

826831
def yscale(*args, **kwargs):
827832
"""
833+
call signature::
834+
835+
xscale(scale, **kwargs)
836+
828837
Set the scaling for the y-axis: %(scale)s
829838
830839
Different keywords may be accepted, depending on the scale:
831840
832841
%(scale_docs)s
833-
""" % {'scale': ' | '.join([repr(x) for x in get_scale_names()]),
834-
'scale_docs': get_scale_docs()}
842+
"""
835843
ax = gca()
836844
ret = ax.set_yscale(*args, **kwargs)
837845
draw_if_interactive()
838846
return ret
839-
847+
yscale.__doc__ = dedent(yscale.__doc__) % {
848+
'scale': ' | '.join([repr(x) for x in get_scale_names()]),
849+
'scale_docs': get_scale_docs()}
840850

841851
def xticks(*args, **kwargs):
842852
"""

lib/matplotlib/scale.py

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,18 @@ def inverted(self):
172172

173173
def __init__(self, axis, **kwargs):
174174
"""
175-
basex/basey: The base of the logarithm
175+
*basex*/*basey*:
176+
The base of the logarithm
176177
177-
subsx/subsy: The number of subticks to draw between each major
178-
tick
178+
*subsx*/*subsy*:
179+
Where to place the subticks between each major tick.
180+
Should be a sequence of integers. For example, in a log10
181+
scale::
182+
183+
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
184+
185+
will place 10 logarithmically spaced minor ticks between
186+
each major tick.
179187
"""
180188
if axis.axis_name == 'x':
181189
base = kwargs.pop('basex', 10.0)
@@ -273,14 +281,22 @@ def inverted(self):
273281

274282
def __init__(self, axis, **kwargs):
275283
"""
276-
basex/basey: The base of the logarithm
284+
*basex*/*basey*:
285+
The base of the logarithm
286+
287+
*linthreshx*/*linthreshy*:
288+
The range (-*x*, *x*) within which the plot is linear (to
289+
avoid having the plot go to infinity around zero).
290+
291+
*subsx*/*subsy*:
292+
Where to place the subticks between each major tick.
293+
Should be a sequence of integers. For example, in a log10
294+
scale::
277295
278-
linthreshx/linthreshy: The range (-x, x) within which the plot
279-
is linear (to avoid having the plot go to infinity around
280-
zero).
296+
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
281297
282-
subsx/subsy: The number of subticks to render between each
283-
major tick.
298+
will place 10 logarithmically spaced minor ticks between
299+
each major tick.
284300
"""
285301
if axis.axis_name == 'x':
286302
base = kwargs.pop('basex', 10.0)
@@ -340,9 +356,8 @@ def get_scale_docs():
340356
scale_class = _scale_mapping[name]
341357
docs.append(" '%s'" % name)
342358
docs.append("")
343-
class_docs = textwrap.wrap(
344-
dedent(scale_class.__init__.__doc__), initial_indent=" " * 8,
345-
subsequent_indent = " " * 8)
346-
docs.extend(class_docs)
359+
class_docs = dedent(scale_class.__init__.__doc__)
360+
class_docs = "".join([" %s\n" % x for x in class_docs.split("\n")])
361+
docs.append(class_docs)
347362
docs.append("")
348363
return "\n".join(docs)

0 commit comments

Comments
 (0)