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

Skip to content

Commit e7c736f

Browse files
authored
Merge pull request #13334 from anntzer/docstringinheritance
DOC: Inherit some docstrings.
2 parents f1366a3 + a78fc7a commit e7c736f

File tree

2 files changed

+46
-39
lines changed

2 files changed

+46
-39
lines changed

lib/matplotlib/axis.py

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def update_position(self, loc):
511511
self.stale = True
512512

513513
def get_view_interval(self):
514-
"""Return the Interval instance for this axis view limits."""
514+
# docstring inherited
515515
return self.axes.viewLim.intervalx
516516

517517

@@ -895,24 +895,47 @@ def set_clip_path(self, clippath, transform=None):
895895
self.stale = True
896896

897897
def get_view_interval(self):
898-
'return the Interval instance for this axis view limits'
898+
"""Return the Interval instance for this axis view limits."""
899899
raise NotImplementedError('Derived must override')
900900

901901
def set_view_interval(self, vmin, vmax, ignore=False):
902+
"""
903+
Set the axis view limits. This method is for internal use; Matplotlib
904+
users should typically use e.g. `~Axes.set_xlim` and `~Axes.set_ylim`.
905+
906+
If *ignore* is False (the default), this method will never reduce the
907+
preexisting view limits, only expand them if *vmin* or *vmax* are not
908+
within them. Moreover, the order of *vmin* and *vmax* does not matter;
909+
the orientation of the axis will not change.
910+
911+
If *ignore* is True, the view limits will be set exactly to ``(vmin,
912+
vmax)`` in that order.
913+
"""
902914
raise NotImplementedError('Derived must override')
903915

904916
def get_data_interval(self):
905-
'return the Interval instance for this axis data limits'
917+
"""Return the Interval instance for this axis data limits."""
906918
raise NotImplementedError('Derived must override')
907919

908-
def set_data_interval(self):
909-
'''set the axis data limits'''
920+
def set_data_interval(self, vmin, vmax, ignore=False):
921+
"""
922+
Set the axis data limits. This method is for internal use.
923+
924+
If *ignore* is False (the default), this method will never reduce the
925+
preexisting data limits, only expand them if *vmin* or *vmax* are not
926+
within them. Moreover, the order of *vmin* and *vmax* does not matter;
927+
the orientation of the axis will not change.
928+
929+
If *ignore* is True, the data limits will be set exactly to ``(vmin,
930+
vmax)`` in that order.
931+
"""
910932
raise NotImplementedError('Derived must override')
911933

912934
def set_default_intervals(self):
913-
'''set the default limits for the axis data and view interval if they
914-
are not mutated'''
915-
935+
"""
936+
Set the default limits for the axis data and view interval if they
937+
have not been not mutated yet.
938+
"""
916939
# this is mainly in support of custom object plotting. For
917940
# example, if someone passes in a datetime object, we do not
918941
# know automagically how to set the default min/max of the
@@ -921,7 +944,6 @@ def set_default_intervals(self):
921944
# default limits through the AxisInfo.default_limits
922945
# attribute, and the derived code below will check for that
923946
# and use it if is available (else just use 0..1)
924-
pass
925947

926948
def _set_artist_props(self, a):
927949
if a is None:
@@ -2028,19 +2050,11 @@ def get_ticks_position(self):
20282050
return "unknown"
20292051

20302052
def get_view_interval(self):
2031-
'return the Interval instance for this axis view limits'
2053+
# docstring inherited
20322054
return self.axes.viewLim.intervalx
20332055

20342056
def set_view_interval(self, vmin, vmax, ignore=False):
2035-
"""
2036-
If *ignore* is *False*, the order of vmin, vmax
2037-
does not matter; the original axis orientation will
2038-
be preserved. In addition, the view limits can be
2039-
expanded, but will not be reduced. This method is
2040-
for mpl internal use; for normal use, see
2041-
:meth:`~matplotlib.axes.Axes.set_xlim`.
2042-
2043-
"""
2057+
# docstring inherited
20442058
if ignore:
20452059
self.axes.viewLim.intervalx = vmin, vmax
20462060
else:
@@ -2056,11 +2070,11 @@ def get_minpos(self):
20562070
return self.axes.dataLim.minposx
20572071

20582072
def get_data_interval(self):
2059-
'return the Interval instance for this axis data limits'
2073+
# docstring inherited
20602074
return self.axes.dataLim.intervalx
20612075

20622076
def set_data_interval(self, vmin, vmax, ignore=False):
2063-
'set the axis data limits'
2077+
# docstring inherited
20642078
if ignore:
20652079
self.axes.dataLim.intervalx = vmin, vmax
20662080
else:
@@ -2069,7 +2083,7 @@ def set_data_interval(self, vmin, vmax, ignore=False):
20692083
self.stale = True
20702084

20712085
def set_default_intervals(self):
2072-
'set the default limits for the axis interval if they are not mutated'
2086+
# docstring inherited
20732087
xmin, xmax = 0., 1.
20742088
dataMutated = self.axes.dataLim.mutatedx()
20752089
viewMutated = self.axes.viewLim.mutatedx()
@@ -2412,19 +2426,11 @@ def get_ticks_position(self):
24122426
return 'unknown'
24132427

24142428
def get_view_interval(self):
2415-
'return the Interval instance for this axis view limits'
2429+
# docstring inherited
24162430
return self.axes.viewLim.intervaly
24172431

24182432
def set_view_interval(self, vmin, vmax, ignore=False):
2419-
"""
2420-
If *ignore* is *False*, the order of vmin, vmax
2421-
does not matter; the original axis orientation will
2422-
be preserved. In addition, the view limits can be
2423-
expanded, but will not be reduced. This method is
2424-
for mpl internal use; for normal use, see
2425-
:meth:`~matplotlib.axes.Axes.set_ylim`.
2426-
2427-
"""
2433+
# docstring inherited
24282434
if ignore:
24292435
self.axes.viewLim.intervaly = vmin, vmax
24302436
else:
@@ -2441,11 +2447,11 @@ def get_minpos(self):
24412447
return self.axes.dataLim.minposy
24422448

24432449
def get_data_interval(self):
2444-
'return the Interval instance for this axis data limits'
2450+
# docstring inherited
24452451
return self.axes.dataLim.intervaly
24462452

24472453
def set_data_interval(self, vmin, vmax, ignore=False):
2448-
'set the axis data limits'
2454+
# docstring inherited
24492455
if ignore:
24502456
self.axes.dataLim.intervaly = vmin, vmax
24512457
else:
@@ -2454,7 +2460,7 @@ def set_data_interval(self, vmin, vmax, ignore=False):
24542460
self.stale = True
24552461

24562462
def set_default_intervals(self):
2457-
'set the default limits for the axis interval if they are not mutated'
2463+
# docstring inherited
24582464
ymin, ymax = 0., 1.
24592465
dataMutated = self.axes.dataLim.mutatedy()
24602466
viewMutated = self.axes.viewLim.mutatedy()

lib/mpl_toolkits/mplot3d/axis3d.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,11 @@ def draw(self, renderer):
445445
self.stale = False
446446

447447
def get_view_interval(self):
448-
"""return the Interval instance for this 3d axis view limits"""
448+
# docstring inherited
449449
return self.v_interval
450450

451451
def set_view_interval(self, vmin, vmax, ignore=False):
452+
# docstring inherited
452453
if ignore:
453454
self.v_interval = vmin, vmax
454455
else:
@@ -468,17 +469,17 @@ def get_tightbbox(self, renderer):
468469

469470
class XAxis(Axis):
470471
def get_data_interval(self):
471-
'return the Interval instance for this axis data limits'
472+
# docstring inherited
472473
return self.axes.xy_dataLim.intervalx
473474

474475

475476
class YAxis(Axis):
476477
def get_data_interval(self):
477-
'return the Interval instance for this axis data limits'
478+
# docstring inherited
478479
return self.axes.xy_dataLim.intervaly
479480

480481

481482
class ZAxis(Axis):
482483
def get_data_interval(self):
483-
'return the Interval instance for this axis data limits'
484+
# docstring inherited
484485
return self.axes.zz_dataLim.intervalx

0 commit comments

Comments
 (0)