diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index 8062ebc66e4a..6a9ceae5e124 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -340,7 +340,7 @@ def _apply_params(self, **kw): # -> points. grab the integer from the `Text` object # instead of saving the string representation v = getattr(self.label1, 'get_' + k)() - setattr(self, '_' + k, v) + setattr(self, '_label' + k, v) class XTick(Tick): diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index df0e48e0cef0..70c5c47f810c 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4335,6 +4335,17 @@ def test_pandas_indexing_hist(): fig, axes = plt.subplots() axes.hist(ser_2) +@cleanup +def test_axis_set_tick_params_labelsize_labelcolor(): + # Tests fix for issue 4346 + axis_1 = plt.subplot() + axis_1.yaxis.set_tick_params(labelsize=30, labelcolor='red', direction='out') + + # Expected values after setting the ticks + assert axis_1.yaxis.majorTicks[0]._size == 4.0 + assert axis_1.yaxis.majorTicks[0]._color == 'k' + assert axis_1.yaxis.majorTicks[0]._labelsize == 30.0 + assert axis_1.yaxis.majorTicks[0]._labelcolor == 'red' if __name__ == '__main__': import nose