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

Skip to content

Commit 9d01770

Browse files
committed
Copy all internals from initial Tick to lazy ones
Fixes #28574
1 parent 9782f14 commit 9d01770

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lib/matplotlib/axis.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,21 @@ def _set_labelrotation(self, labelrotation):
198198
_api.check_in_list(['auto', 'default'], labelrotation=mode)
199199
self._labelrotation = (mode, angle)
200200

201+
@property
202+
def _pad(self):
203+
return self._base_pad + self.get_tick_padding()
204+
201205
def _apply_tickdir(self, tickdir):
202206
"""Set tick direction. Valid values are 'out', 'in', 'inout'."""
203-
# This method is responsible for updating `_pad`, and, in subclasses,
204-
# for setting the tick{1,2}line markers as well. From the user
205-
# perspective this should always be called through _apply_params, which
206-
# 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.
207211
if tickdir is None:
208212
tickdir = mpl.rcParams[f'{self.__name__}.direction']
209213
else:
210214
_api.check_in_list(['in', 'out', 'inout'], tickdir=tickdir)
211215
self._tickdir = tickdir
212-
self._pad = self._base_pad + self.get_tick_padding()
213216

214217
def get_tickdir(self):
215218
return self._tickdir
@@ -1615,6 +1618,13 @@ def _copy_tick_props(self, src, dest):
16151618
dest.tick1line.update_from(src.tick1line)
16161619
dest.tick2line.update_from(src.tick2line)
16171620
dest.gridline.update_from(src.gridline)
1621+
dest._loc = src._loc
1622+
dest._size = src._size
1623+
dest._width = src._width
1624+
dest._base_pad = src._base_pad
1625+
dest._labelrotation = src._labelrotation
1626+
dest._zorder = src._zorder
1627+
dest._tickdir = src._tickdir
16181628

16191629
def get_label_text(self):
16201630
"""Get the text of the label."""

0 commit comments

Comments
 (0)