diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 6470d2d18624..a67f6b2bd866 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -3056,28 +3056,27 @@ def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs): Parameters ---------- labels : list of str - list of string labels + List of string labels. fontdict : dict, optional - A dictionary controlling the appearance of the ticklabels, - the default `fontdict` is: + A dictionary controlling the appearance of the ticklabels. + The default `fontdict` is:: {'fontsize': rcParams['axes.titlesize'], - 'fontweight' : rcParams['axes.titleweight'], + 'fontweight': rcParams['axes.titleweight'], 'verticalalignment': 'baseline', 'horizontalalignment': loc} minor : bool, optional - If True select the minor ticklabels, - else select the major ticklabels + Whether to set the minor ticklabels rather than the major ones. Returns ------- - A list of `~matplotlib.text.Text` instances + A list of `~.text.Text` instances. Other Parameters ----------------- - **kwargs : `~matplotlib.text.Text` properties. + **kwargs : `~.text.Text` properties. """ if fontdict is not None: kwargs.update(fontdict) @@ -3374,25 +3373,24 @@ def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs): list of string labels fontdict : dict, optional - A dictionary controlling the appearance of the ticklabels, - the default `fontdict` is:: + A dictionary controlling the appearance of the ticklabels. + The default `fontdict` is:: {'fontsize': rcParams['axes.titlesize'], - 'fontweight' : rcParams['axes.titleweight'], + 'fontweight': rcParams['axes.titleweight'], 'verticalalignment': 'baseline', 'horizontalalignment': loc} minor : bool, optional - If True select the minor ticklabels, - else select the major ticklabels + Whether to set the minor ticklabels rather than the major ones. Returns ------- - A list of `~matplotlib.text.Text` instances. + A list of `~.text.Text` instances. Other Parameters ---------------- - **kwargs : `~matplotlib.text.Text` properties. + **kwargs : `~.text.Text` properties. """ if fontdict is not None: kwargs.update(fontdict) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index eb13d2e5f6dd..bc763834bc8c 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -988,7 +988,7 @@ def add_subplot(self, *args, **kwargs): grid with J rows and K columns. projection : ['aitoff' | 'hammer' | 'lambert' | \ -'mollweide', 'polar' | 'rectilinear'], optional +'mollweide' | 'polar' | 'rectilinear'], optional The projection type of the axes. polar : boolean, optional diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 917ce74c8eef..d54adc7d0a6a 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -37,100 +37,96 @@ The Locator subclasses defined here are -:class:`NullLocator` - No ticks - -:class:`FixedLocator` - Tick locations are fixed +:class:`AutoLocator` + `MaxNLocator` with simple defaults. This is the default tick locator for + most plotting. -:class:`IndexLocator` - locator for index plots (e.g., where x = range(len(y))) +:class:`MaxNLocator` + Finds up to a max number of intervals with ticks at nice locations. :class:`LinearLocator` - evenly spaced ticks from min to max + Space ticks evenly from min to max. :class:`LogLocator` - logarithmically ticks from min to max - -:class:`SymmetricalLogLocator` - locator for use with with the symlog norm, works like the - `LogLocator` for the part outside of the threshold and add 0 if - inside the limits + Space ticks logarithmically from min to max. :class:`MultipleLocator` - ticks and range are a multiple of base; either integer or float + Ticks and range are a multiple of base; either integer or float. -:class:`OldAutoLocator` - choose a MultipleLocator and dyamically reassign it for - intelligent ticking during navigation +:class:`FixedLocator` + Tick locations are fixed. -:class:`MaxNLocator` - finds up to a max number of ticks at nice locations +:class:`IndexLocator` + Locator for index plots (e.g., where ``x = range(len(y))``). -:class:`AutoLocator` - :class:`MaxNLocator` with simple defaults. This is the default - tick locator for most plotting. +:class:`NullLocator` + No ticks. -:class:`AutoMinorLocator` - locator for minor ticks when the axis is linear and the - major ticks are uniformly spaced. It subdivides the major - tick interval into a specified number of minor intervals, - defaulting to 4 or 5 depending on the major interval. +:class:`SymmetricalLogLocator` + Locator for use with with the symlog norm; works like `LogLocator` for the + part outside of the threshold and adds 0 if inside the limits. :class:`LogitLocator` Locator for logit scaling. +:class:`OldAutoLocator` + Choose a `MultipleLocator` and dynamically reassign it for intelligent + ticking during navigation. + +:class:`AutoMinorLocator` + Locator for minor ticks when the axis is linear and the + major ticks are uniformly spaced. Subdivides the major + tick interval into a specified number of minor intervals, + defaulting to 4 or 5 depending on the major interval. + There are a number of locators specialized for date locations - see -the dates module +the `dates` module. You can define your own locator by deriving from Locator. You must override the ``__call__`` method, which returns a sequence of locations, and you will probably want to override the autoscale method to set the view limits from the data limits. -If you want to override the default locator, use one of the above or a -custom locator and pass it to the x or y axis instance. The relevant -methods are:: +If you want to override the default locator, use one of the above or a custom +locator and pass it to the x or y axis instance. The relevant methods are:: - ax.xaxis.set_major_locator( xmajorLocator ) - ax.xaxis.set_minor_locator( xminorLocator ) - ax.yaxis.set_major_locator( ymajorLocator ) - ax.yaxis.set_minor_locator( yminorLocator ) + ax.xaxis.set_major_locator(xmajor_locator) + ax.xaxis.set_minor_locator(xminor_locator) + ax.yaxis.set_major_locator(ymajor_locator) + ax.yaxis.set_minor_locator(yminor_locator) -The default minor locator is the NullLocator, e.g., no minor ticks on by -default. +The default minor locator is `NullLocator`, i.e., no minor ticks on by default. Tick formatting --------------- -Tick formatting is controlled by classes derived from Formatter. The -formatter operates on a single tick value and returns a string to the -axis. +Tick formatting is controlled by classes derived from Formatter. The formatter +operates on a single tick value and returns a string to the axis. :class:`NullFormatter` - No labels on the ticks + No labels on the ticks. :class:`IndexFormatter` - Set the strings from a list of labels + Set the strings from a list of labels. :class:`FixedFormatter` - Set the strings manually for the labels + Set the strings manually for the labels. :class:`FuncFormatter` - User defined function sets the labels + User defined function sets the labels. :class:`StrMethodFormatter` - Use string `format` method + Use string `format` method. :class:`FormatStrFormatter` - Use an old-style sprintf format string + Use an old-style sprintf format string. :class:`ScalarFormatter` - Default formatter for scalars: autopick the format string + Default formatter for scalars: autopick the format string. :class:`LogFormatter` - Formatter for log axes + Formatter for log axes. :class:`LogFormatterExponent` Format values for log axis using ``exponent = log_base(value)``. @@ -158,10 +154,10 @@ To control the major and minor tick label formats, use one of the following methods:: - ax.xaxis.set_major_formatter( xmajorFormatter ) - ax.xaxis.set_minor_formatter( xminorFormatter ) - ax.yaxis.set_major_formatter( ymajorFormatter ) - ax.yaxis.set_minor_formatter( yminorFormatter ) + ax.xaxis.set_major_formatter(xmajor_formatter) + ax.xaxis.set_minor_formatter(xminor_formatter) + ax.yaxis.set_major_formatter(ymajor_formatter) + ax.yaxis.set_minor_formatter(yminor_formatter) See :ref:`sphx_glr_gallery_ticks_and_spines_major_minor_demo.py` for an example of setting major and minor ticks. See the :mod:`matplotlib.dates`