|
33 | 33 | _gridline_param_names = ['grid_' + name
|
34 | 34 | for name in _line_param_names + _line_param_aliases]
|
35 | 35 |
|
36 |
| -_MARKER_DICT = { |
37 |
| - 'out': (mlines.TICKDOWN, mlines.TICKUP), |
38 |
| - 'in': (mlines.TICKUP, mlines.TICKDOWN), |
39 |
| - 'inout': ('|', '|'), |
40 |
| -} |
41 |
| - |
42 | 36 |
|
43 | 37 | class Tick(martist.Artist):
|
44 | 38 | """
|
@@ -204,18 +198,21 @@ def _set_labelrotation(self, labelrotation):
|
204 | 198 | _api.check_in_list(['auto', 'default'], labelrotation=mode)
|
205 | 199 | self._labelrotation = (mode, angle)
|
206 | 200 |
|
| 201 | + @property |
| 202 | + def _pad(self): |
| 203 | + return self._base_pad + self.get_tick_padding() |
| 204 | + |
207 | 205 | def _apply_tickdir(self, tickdir):
|
208 | 206 | """Set tick direction. Valid values are 'out', 'in', 'inout'."""
|
209 |
| - # This method is responsible for updating `_pad`, and, in subclasses, |
210 |
| - # for setting the tick{1,2}line markers as well. From the user |
211 |
| - # perspective this should always be called through _apply_params, which |
212 |
| - # further updates ticklabel positions using the new pads. |
| 207 | + # This method is responsible for verifying input and, in subclasses, for setting |
| 208 | + # the tick{1,2}line markers. From the user perspective this should always be |
| 209 | + # called through _apply_params, which further updates ticklabel positions using |
| 210 | + # the new pads. |
213 | 211 | if tickdir is None:
|
214 | 212 | tickdir = mpl.rcParams[f'{self.__name__}.direction']
|
215 | 213 | else:
|
216 | 214 | _api.check_in_list(['in', 'out', 'inout'], tickdir=tickdir)
|
217 | 215 | self._tickdir = tickdir
|
218 |
| - self._pad = self._base_pad + self.get_tick_padding() |
219 | 216 |
|
220 | 217 | def get_tickdir(self):
|
221 | 218 | return self._tickdir
|
@@ -425,7 +422,11 @@ def _get_text2_transform(self):
|
425 | 422 | def _apply_tickdir(self, tickdir):
|
426 | 423 | # docstring inherited
|
427 | 424 | super()._apply_tickdir(tickdir)
|
428 |
| - mark1, mark2 = _MARKER_DICT[self._tickdir] |
| 425 | + mark1, mark2 = { |
| 426 | + 'out': (mlines.TICKDOWN, mlines.TICKUP), |
| 427 | + 'in': (mlines.TICKUP, mlines.TICKDOWN), |
| 428 | + 'inout': ('|', '|'), |
| 429 | + }[self._tickdir] |
429 | 430 | self.tick1line.set_marker(mark1)
|
430 | 431 | self.tick2line.set_marker(mark2)
|
431 | 432 |
|
@@ -1617,6 +1618,14 @@ def _copy_tick_props(self, src, dest):
|
1617 | 1618 | dest.tick1line.update_from(src.tick1line)
|
1618 | 1619 | dest.tick2line.update_from(src.tick2line)
|
1619 | 1620 | dest.gridline.update_from(src.gridline)
|
| 1621 | + dest.update_from(src) |
| 1622 | + dest._loc = src._loc |
| 1623 | + dest._size = src._size |
| 1624 | + dest._width = src._width |
| 1625 | + dest._base_pad = src._base_pad |
| 1626 | + dest._labelrotation = src._labelrotation |
| 1627 | + dest._zorder = src._zorder |
| 1628 | + dest._tickdir = src._tickdir |
1620 | 1629 |
|
1621 | 1630 | def get_label_text(self):
|
1622 | 1631 | """Get the text of the label."""
|
|
0 commit comments