10000 MNT: move around methods on Axis and friends · matplotlib/matplotlib@7b29662 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7b29662

Browse files
committed
MNT: move around methods on Axis and friends
- remove identical code in YAxis and XAxis, move to Axis - add abstract methods on Axis and Tick to make documenting easier
1 parent 64dc7af commit 7b29662

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

lib/matplotlib/axis.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ def _apply_params(self, **kw):
340340
v = getattr(self.label1, 'get_' + k)()
341341
setattr(self, '_label' + k, v)
342342

343+
def update_position(self, loc):
344+
'Set the location of tick in data coords with scalar *loc*'
345+
raise NotImplementedError('Derived must override')
346+
343347

344348
class XTick(Tick):
345349
"""
@@ -1670,6 +1674,23 @@ def get_tick_space(self):
16701674
# Must be overridden in the subclass
16711675
raise NotImplementedError()
16721676

1677+
def get_label_position(self):
1678+
"""
1679+
Return the label position (top or bottom)
1680+
"""
1681+
return self.label_position
1682+
1683+
def set_label_position(self, position):
1684+
"""
1685+
Set the label position (top or bottom)
1686+
1687+
ACCEPTS: [ 'top' | 'bottom' ]
1688+
"""
1689+
raise NotImplementedError()
1690+
1691+
def get_minpos(self):
1692+
raise NotImplementedError()
1693+
16731694

16741695
class XAxis(Axis):
16751696
__name__ = 'xaxis'
@@ -1769,12 +1790,6 @@ def _get_pixel_distance_along_axis(self, where, perturb):
17691790

17701791
return dx
17711792

1772-
def get_label_position(self):
1773-
"""
1774-
Return the label position (top or bottom)
1775-
"""
1776-
return self.label_position
1777-
17781793
def set_label_position(self, position):
17791794
"""
17801795
Set the label position (top or bottom)
@@ -2098,12 +2113,6 @@ def _get_pixel_distance_along_axis(self, where, perturb):
20982113
dy = abs(ptp[1] - where)
20992114
return dy
21002115

2101-
def get_label_position(self):
2102-
"""
2103-
Return the label position (left or right)
2104-
"""
2105-
return self.label_position
2106-
21072116
def set_label_position(self, position):
21082117
"""
21092118
Set the label position (left or right)

0 commit comments

Comments
 (0)
0