From c2627f03589f18c91c2167e5f6799a1449126e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Fr=C3=BCnd?= Date: Tue, 21 Apr 2020 16:57:26 -0400 Subject: [PATCH 1/3] tests for tick color compare properties --- lib/matplotlib/tests/test_axes.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 80703428ae8f..7eb75b0acd86 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 not 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 not tick.tick1line.get_markeredgecolor() == 'white' From 1273dea678459050f303b52b3bfc803c45d1629e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Fr=C3=BCnd?= Date: Thu, 19 Mar 2020 15:51:13 -0400 Subject: [PATCH 2/3] markeredge color does not affect tick color --- lib/matplotlib/axis.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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(): From 8ed945884539290f686e230a5f778a8d2066c750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Fr=C3=BCnd?= Date: Thu, 23 Apr 2020 17:36:42 -0400 Subject: [PATCH 3/3] using != instead of not === --- lib/matplotlib/tests/test_axes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 7eb75b0acd86..53bc10b15b3d 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -6136,7 +6136,7 @@ def test_xtickcolor_is_not_markercolor(): ax = plt.axes() ticks = ax.xaxis.get_major_ticks() for tick in ticks: - assert not tick.tick1line.get_markeredgecolor() == 'white' + assert tick.tick1line.get_markeredgecolor() != 'white' def test_ytickcolor_is_not_markercolor(): @@ -6144,4 +6144,4 @@ def test_ytickcolor_is_not_markercolor(): ax = plt.axes() ticks = ax.yaxis.get_major_ticks() for tick in ticks: - assert not tick.tick1line.get_markeredgecolor() == 'white' + assert tick.tick1line.get_markeredgecolor() != 'white'