Skip to content

Commit 48910ca

Browse files
committed
Add get_tick_params().
1 parent 9b1fcf6 commit 48910ca

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3400,6 +3400,23 @@ def tick_params(self, axis='both', **kwargs):
34003400
ykw.pop('labelbottom', None)
34013401
self.yaxis.set_tick_params(**ykw)
34023402

3403+
def get_tick_params(self, axis, which='major'):
3404+
"""
3405+
Get the appearance of ticks, tick labels, and gridlines.
3406+
3407+
Parameters
3408+
----------
3409+
axis : {'x', 'y'}
3410+
The axis to which the parameters are applied.
3411+
which : {'major', 'minor'}, default: 'major'
3412+
The group of ticks to which the parameters are applied.
3413+
3414+
"""
3415+
_api.check_in_list(['x', 'y'], axis=axis)
3416+
if axis == 'x':
3417+
return self.xaxis.get_tick_params(which=which)
3418+
return self.yaxis.get_tick_params(which=which)
3419+
34033420
def set_axis_off(self):
34043421
"""
34053422
Turn the x- and y-axis off.

lib/matplotlib/axis.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,18 @@ def set_tick_params(self, which='major', reset=False, **kwargs):
973973

974974
self.stale = True
975975

976+
def get_tick_params(self, which='major'):
977+
"""
978+
Get appearance parameters for ticks, ticklabels, and gridlines.
979+
980+
For documentation of keyword arguments, see
981+
:meth:`matplotlib.axes.Axes.get_tick_params`.
982+
"""
983+
_api.check_in_list(['major', 'minor'], which=which)
984+
if which == 'major':
985+
return self._major_tick_kw
986+
return self._minor_tick_kw
987+
976988
@staticmethod
977989
def _translate_tick_params(kw):
978990
"""

0 commit comments

Comments
 (0)