11from collections import OrderedDict
22from contextlib import ExitStack
33import functools
4+ import inspect
45import itertools
56import logging
67import math
@@ -44,7 +45,8 @@ def _axis_method_wrapper(attr_name, method_name, *, doc_sub=None):
4445
4546 The docstring of ``get_foo`` is built by replacing "this Axis" by "the
4647 {attr_name}" ("the xaxis", "the yaxis") in the wrapped method's docstring;
47- additional replacements can by given in *doc_sub*.
48+ additional replacements can by given in *doc_sub*. The docstring is also
49+ dedented to simplify further manipulations.
4850 """
4951
5052 method = getattr (maxis .Axis , method_name )
@@ -62,7 +64,7 @@ def wrapper(self, *args, **kwargs):
6264 (f"The docstring of wrapped Axis method { method_name !r} must "
6365 f"contain { k !r} as a substring." )
6466 doc = doc .replace (k , v )
65- wrapper .__doc__ = doc
67+ wrapper .__doc__ = inspect . cleandoc ( doc )
6668
6769 return wrapper
6870
@@ -3635,29 +3637,8 @@ def set_yscale(self, value, **kwargs):
36353637 "yaxis" , "_set_ticklabels" ,
36363638 doc_sub = {"Axis.set_ticks" : "Axes.set_yticks" })
36373639
3638- def xaxis_date (self , tz = None ):
3639- """
3640- Sets up x-axis ticks and labels that treat the x data as dates.
3641-
3642- Parameters
3643- ----------
3644- tz : str or `datetime.tzinfo`, default: :rc:`timezone`
3645- Timezone.
3646- """
3647- # should be enough to inform the unit conversion interface
3648- # dates are coming in
3649- self .xaxis .axis_date (tz )
3650-
3651- def yaxis_date (self , tz = None ):
3652- """
3653- Sets up y-axis ticks and labels that treat the y data as dates.
3654-
3655- Parameters
3656- ----------
3657- tz : str or `datetime.tzinfo`, default: :rc:`timezone`
3658- Timezone.
3659- """
3660- self .yaxis .axis_date (tz )
3640+ xaxis_date = _axis_method_wrapper ("xaxis" , "axis_date" )
3641+ yaxis_date = _axis_method_wrapper ("yaxis" , "axis_date" )
36613642
36623643 def format_xdata (self , x ):
36633644 """
0 commit comments