Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 909557b

Browse files
committed
Convert get_ticklabels/add_axes/add_subplot to numpydoc
1 parent 9dd0db6 commit 909557b

File tree

2 files changed

+87
-38
lines changed

2 files changed

+87
-38
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3011,9 +3011,9 @@ def get_xticklabels(self, minor=False, which=None):
30113011
30123012
Parameters
30133013
----------
3014-
minor : bool
3014+
minor : bool, optional
30153015
If True return the minor ticklabels,
3016-
else return the major ticklabels
3016+
else return the major ticklabels.
30173017
30183018
which : None, ('minor', 'major', 'both')
30193019
Overrides `minor`.
@@ -3038,6 +3038,19 @@ def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs):
30383038
labels : list of str
30393039
list of string labels
30403040
3041+
fontdict : dict, optional
3042+
A dictionary controlling the appearance of the ticklabels,
3043+
the default `fontdict` is:
3044+
3045+
{'fontsize': rcParams['axes.titlesize'],
3046+
'fontweight' : rcParams['axes.titleweight'],
3047+
'verticalalignment': 'baseline',
3048+
'horizontalalignment': loc}
3049+
3050+
minor : bool, optional
3051+
If True select the minor ticklabels,
3052+
else select the minor ticklabels
3053+
30413054
Returns
30423055
-------
30433056
A list of `~matplotlib.text.Text` instances
@@ -3335,6 +3348,19 @@ def set_yticklabels(self, labels, fontdict=None, minor=False, **kwargs):
33353348
labels : list of str
33363349
list of string labels
33373350
3351+
fontdict : dict, optional
3352+
A dictionary controlling the appearance of the ticklabels,
3353+
the default `fontdict` is::
3354+
3355+
{'fontsize': rcParams['axes.titlesize'],
3356+
'fontweight' : rcParams['axes.titleweight'],
3357+
'verticalalignment': 'baseline',
3358+
'horizontalalignment': loc}
3359+
3360+
minor : bool, optional
3361+
If True select the minor ticklabels,
3362+
else select the minor ticklabels
3363+
33383364
Returns
33393365
-------
33403366
A list of `~matplotlib.text.Text` instances.

lib/matplotlib/figure.py

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -860,20 +860,35 @@ def fixlist(args):
860860
key = fixlist(args), fixitems(six.iteritems(kwargs))
861861
return key
862862

863-
@docstring.dedent_interpd
864863
def add_axes(self, *args, **kwargs):
865864
"""
866865
Add an axes at position *rect* [*left*, *bottom*, *width*,
867866
*height*] where all quantities are in fractions of figure
868-
width and height. kwargs are legal
869-
:class:`~matplotlib.axes.Axes` kwargs plus *projection* which
870-
sets the projection type of the axes. (For backward
871-
compatibility, ``polar=True`` may also be provided, which is
872-
equivalent to ``projection='polar'``). Valid values for
873-
*projection* are: %(projection_names)s. Some of these
874-
projections support additional kwargs, which may be provided
875-
to :meth:`add_axes`. Typical usage::
867+
width and height.
868+
869+
Parameters
870+
----------
871+
rect : sequence of float
872+
A 4-length sequence of [left, bottom, width, height] quantities.
873+
874+
projection :
875+
[‘aitoff’ | ‘hammer’ | ‘lambert’ | ‘mollweide’ | \
876+
‘polar’ | ‘rectilinear’], optional
877+
The projection type of the axes.
878+
879+
polar : boolean, optional
880+
If True, equivalent to projection='polar'.
876881
882+
This method also takes the keyword arguments for
883+
:class:`~matplotlib.axes.Axes`.
884+
885+
Returns
886+
------
887+
axes : Axes
888+
The added axes.
889+
890+
Examples
891+
--------
877892
rect = l,b,w,h
878893
fig.add_axes(rect)
879894
fig.add_axes(rect, frameon=False, facecolor='g')
@@ -903,10 +918,6 @@ def add_axes(self, *args, **kwargs):
903918
904919
In all cases, the :class:`~matplotlib.axes.Axes` instance
905920
will be returned.
906-
907-
In addition to *projection*, the following kwargs are supported:
908-
909-
%(Axes)s
910921
"""
911922
if not len(args):
912923
return
@@ -949,11 +960,41 @@ def add_axes(self, *args, **kwargs):
949960
a.stale_callback = _stale_figure_callback
950961
return a
951962

952-
@docstring.dedent_interpd
953963
def add_subplot(self, *args, **kwargs):
954964
"""
955-
Add a subplot. Examples::
965+
Add a subplot.
966+
967+
Parameters
968+
----------
969+
*args
970+
Either a 3-digit integer or three separate integers
971+
describing the position of the subplot. If the three
972+
integers are I, J, and K, the subplot is the Ith plot on a
973+
grid with J rows and K columns.
974+
975+
projection : [‘aitoff’ | ‘hammer’ | ‘lambert’ | \
976+
‘mollweide’, ‘polar’ | ‘rectilinear’], optional
977+
The projection type of the axes.
978+
979+
polar : boolean, optional
980+
If True, equivalent to projection='polar'.
956981
982+
This method also takes the keyword arguments for
983+
:class:`~matplotlib.axes.Axes`.
984+
985+
Returns
986+
-------
987+
axes : Axes
988+
The axes of the subplot.
989+
990+
Notes
991+
-----
992+
If the figure already has a subplot with key (*args*,
993+
*kwargs*) then it will simply make that subplot current and
994+
return it.
995+
996+
Examples
997+
--------
957998
fig.add_subplot(111)
958999
9591000
# equivalent but more general
@@ -968,27 +1009,9 @@ def add_subplot(self, *args, **kwargs):
9681009
# add Subplot instance sub
9691010
fig.add_subplot(sub)
9701011
971-
*kwargs* are legal :class:`~matplotlib.axes.Axes` kwargs plus
972-
*projection*, which chooses a projection type for the axes.
973-
(For backward compatibility, *polar=True* may also be
974-
provided, which is equivalent to *projection='polar'*). Valid
975-
values for *projection* are: %(projection_names)s. Some of
976-
these projections
977-
support additional *kwargs*, which may be provided to
978-
:meth:`add_axes`.
979-
980-
The :class:`~matplotlib.axes.Axes` instance will be returned.
981-
982-
If the figure already has a subplot with key (*args*,
983-
*kwargs*) then it will simply make that subplot current and
984-
return it.
985-
986-
.. seealso:: :meth:`~matplotlib.pyplot.subplot` for an
987-
explanation of the args.
988-
989-
The following kwargs are supported:
990-
991-
%(Axes)s
1012+
See Also
1013+
--------
1014+
matplotlib.pyplot.subplot : for an explanation of the args.
9921015
"""
9931016
if not len(args):
9941017
return

0 commit comments

Comments
 (0)