Skip to content

Commit c3c441d

Browse files
committed
Add example to docstring; tweak returns and parameter sections.
1 parent 5110933 commit c3c441d

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

lib/matplotlib/axis.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,11 +962,12 @@ def get_tick_params(self, which='major'):
962962
Parameters
963963
----------
964964
which : {'major', 'minor'}, default: 'major'
965-
The group of ticks to which the parameters are applied.
965+
The group of ticks for which the parameters are retrieved.
966966
967967
Returns
968968
-------
969-
dict on properties that deviate from the default
969+
dict
970+
Default properties for styling *new* elements added to this axis.
970971
971972
Notes
972973
-----
@@ -975,6 +976,31 @@ def get_tick_params(self, which='major'):
975976
elements, if they were modified directly by the user (e.g., via
976977
``set_*`` methods on individual tick objects).
977978
979+
Examples
980+
--------
981+
::
982+
983+
>>> ax.yaxis.set_tick_params(labelsize=30, labelcolor='red',
984+
direction='out', which='major')
985+
>>> ax.yaxis.get_tick_params(which='major')
986+
{'direction': 'out',
987+
'left': True,
988+
'right': False,
989+
'labelleft': True,
990+
'labelright': False,
991+
'gridOn': False,
992+
'labelsize': 30,
993+
'labelcolor': 'red'}
994+
>>> ax.yaxis.get_tick_params(which='minor')
995+
{'left': True,
996+
'right': False,
997+
'labelleft': True,
998+
'labelright': False,
999+
'gridOn': False}
1000+
1001+
This allows us to confirm without visual inspection of the plot
1002+
that our styling is having the desired effect.
1003+
9781004
"""
9791005
_api.check_in_list(['major', 'minor'], which=which)
9801006
if which == 'major':

0 commit comments

Comments
 (0)