diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 5637bdd3a676..359999c73720 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -148,12 +148,12 @@ def __init__(self, axes, loc, label=None, self.tick1line = mlines.Line2D( [], [], color=color, linestyle="none", zorder=zorder, visible=tick1On, - markersize=size, markeredgewidth=width, + markeredgecolor=color, markersize=size, markeredgewidth=width, ) self.tick2line = mlines.Line2D( [], [], color=color, linestyle="none", zorder=zorder, visible=tick2On, - markersize=size, markeredgewidth=width, + markeredgecolor=color, markersize=size, markeredgewidth=width, ) self.gridline = mlines.Line2D( [], [], @@ -352,6 +352,8 @@ def _apply_params(self, **kw): trans = self._get_text2_transform()[0] self.label2.set_transform(trans) tick_kw = {k: v for k, v in kw.items() if k in ['color', 'zorder']} + if 'color' in kw: + tick_kw['markeredgecolor'] = kw['color'] self.tick1line.set(**tick_kw) self.tick2line.set(**tick_kw) for k, v in tick_kw.items(): diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 80703428ae8f..53bc10b15b3d 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -6129,3 +6129,19 @@ def test_invisible_axes(): assert fig.canvas.inaxes((200, 200)) is not None ax.set_visible(False) assert fig.canvas.inaxes((200, 200)) is None + + +def test_xtickcolor_is_not_markercolor(): + plt.rcParams['lines.markeredgecolor'] = 'white' + ax = plt.axes() + ticks = ax.xaxis.get_major_ticks() + for tick in ticks: + assert tick.tick1line.get_markeredgecolor() != 'white' + + +def test_ytickcolor_is_not_markercolor(): + plt.rcParams['lines.markeredgecolor'] = 'white' + ax = plt.axes() + ticks = ax.yaxis.get_major_ticks() + for tick in ticks: + assert tick.tick1line.get_markeredgecolor() != 'white'