Skip to content

Convert tick-setting methods to docstrings #9192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 47 additions & 18 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2993,24 +2993,39 @@ def set_xticks(self, ticks, minor=False):
"""
Set the x ticks with list of *ticks*

ACCEPTS: sequence of floats
Parameters
----------
ticks : list
List of x-axis tick locations

minor : bool, optional
If ``False`` sets major ticks, if ``True`` sets minor ticks.
Default is ``False``.
"""
ret = self.xaxis.set_ticks(ticks, minor=minor)
self.stale = True
return ret

def get_xmajorticklabels(self):
"""
Get the xtick labels as a list of :class:`~matplotlib.text.Text`
instances.
Get the xtick major labels

Returns
-------
labels : list
List of :class:`~matplotlib.text.Text` instances
"""
return cbook.silent_list('Text xticklabel',
self.xaxis.get_majorticklabels())

def get_xminorticklabels(self):
"""
Get the x minor tick labels as a list of
:class:`matplotlib.text.Text` instances.
Get the x minor tick labels

Returns
-------
labels : list
List of :class:`~matplotlib.text.Text` instances
"""
return cbook.silent_list('Text xticklabel',
self.xaxis.get_minorticklabels())
Expand Down Expand Up @@ -3299,28 +3314,38 @@ def set_yticks(self, ticks, minor=False):
"""
Set the y ticks with list of *ticks*

ACCEPTS: sequence of floats

Keyword arguments:
Parameters
----------
ticks : sequence
List of y-axis tick locations

*minor*: [ *False* | *True* ]
Sets the minor ticks if *True*
minor : bool, optional
If ``False`` sets major ticks, if ``True`` sets minor ticks.
Default is ``False``.
"""
ret = self.yaxis.set_ticks(ticks, minor=minor)
return ret

def get_ymajorticklabels(self):
"""
Get the major y tick labels as a list of
:class:`~matplotlib.text.Text` instances.
Get the major y tick labels

Returns
-------
labels : list
List of :class:`~matplotlib.text.Text` instances
"""
return cbook.silent_list('Text yticklabel',
self.yaxis.get_majorticklabels())

def get_yminorticklabels(self):
"""
Get the minor y tick labels as a list of
:class:`~matplotlib.text.Text` instances.
Get the minor y tick labels

Returns
-------
labels : list
List of :class:`~matplotlib.text.Text` instances
"""
return cbook.silent_list('Text yticklabel',
self.yaxis.get_minorticklabels())
Expand Down Expand Up @@ -3389,8 +3414,10 @@ def xaxis_date(self, tz=None):
"""
Sets up x-axis ticks and labels that treat the x data as dates.

*tz* is a timezone string or :class:`tzinfo` instance.
Defaults to rc value.
Parameters
----------
tz : string or :class:`tzinfo` instance, optional
Timezone string or timezone. Defaults to rc value.
"""
# should be enough to inform the unit conversion interface
# dates are coming in
Expand All @@ -3400,8 +3427,10 @@ def yaxis_date(self, tz=None):
"""
Sets up y-axis ticks and labels that treat the y data as dates.

*tz* is a timezone string or :class:`tzinfo` instance.
Defaults to rc value.
Parameters
----------
tz : string or :class:`tzinfo` instance, optional
Timezone string or timezone. Defaults to rc value.
"""
self.yaxis.axis_date(tz)

Expand Down