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

Skip to content

Commit 88dfcef

Browse files
committed
Improve mpl_toolkit documentation
1 parent 9bcdd60 commit 88dfcef

File tree

11 files changed

+408
-173
lines changed

11 files changed

+408
-173
lines changed

lib/mpl_toolkits/axes_grid1/anchored_artists.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, width, height, xdescent, ydescent,
1414
loc, pad=0.4, borderpad=0.5, prop=None, frameon=True,
1515
**kwargs):
1616
"""
17-
An anchored container with a fixed size and fillable DrawingArea.
17+
An anchored container with a fixed size and fillable `.DrawingArea`.
1818
1919
Artists added to the *drawing_area* will have their coordinates
2020
interpreted as pixels. Any transformations set on the artists will be
@@ -37,16 +37,16 @@ def __init__(self, width, height, xdescent, ydescent,
3737
Padding around the child objects, in fraction of the font size.
3838
borderpad : float, default: 0.5
3939
Border padding, in fraction of the font size.
40-
prop : `matplotlib.font_manager.FontProperties`, optional
40+
prop : `~matplotlib.font_manager.FontProperties`, optional
4141
Font property used as a reference for paddings.
4242
frameon : bool, default: True
43-
If True, draw a box around this artists.
43+
If True, draw a box around this artist.
4444
**kwargs
4545
Keyword arguments forwarded to `.AnchoredOffsetbox`.
4646
4747
Attributes
4848
----------
49-
drawing_area : `matplotlib.offsetbox.DrawingArea`
49+
drawing_area : `~matplotlib.offsetbox.DrawingArea`
5050
A container for artists to display.
5151
5252
Examples
@@ -81,7 +81,7 @@ def __init__(self, transform, loc,
8181
8282
Parameters
8383
----------
84-
transform : `matplotlib.transforms.Transform`
84+
transform : `~matplotlib.transforms.Transform`
8585
The transformation object for the coordinate system in use, i.e.,
8686
:attr:`matplotlib.axes.Axes.transData`.
8787
loc : str
@@ -95,16 +95,16 @@ def __init__(self, transform, loc,
9595
Padding around the child objects, in fraction of the font size.
9696
borderpad : float, default: 0.5
9797
Border padding, in fraction of the font size.
98-
prop : `matplotlib.font_manager.FontProperties`, optional
98+
prop : `~matplotlib.font_manager.FontProperties`, optional
9999
Font property used as a reference for paddings.
100100
frameon : bool, default: True
101-
If True, draw a box around this artists.
101+
If True, draw a box around this artist.
102102
**kwargs
103103
Keyword arguments forwarded to `.AnchoredOffsetbox`.
104104
105105
Attributes
106106
----------
107-
drawing_area : `matplotlib.offsetbox.AuxTransformBox`
107+
drawing_area : `~matplotlib.offsetbox.AuxTransformBox`
108108
A container for artists to display.
109109
110110
Examples
@@ -132,7 +132,7 @@ def __init__(self, transform, width, height, angle, loc,
132132
133133
Parameters
134134
----------
135-
transform : `matplotlib.transforms.Transform`
135+
transform : `~matplotlib.transforms.Transform`
136136
The transformation object for the coordinate system in use, i.e.,
137137
:attr:`matplotlib.axes.Axes.transData`.
138138
width, height : float
@@ -153,14 +153,14 @@ def __init__(self, transform, width, height, angle, loc,
153153
Border padding, in fraction of the font size.
154154
frameon : bool, default: True
155155
If True, draw a box around the ellipse.
156-
prop : `matplotlib.font_manager.FontProperties`, optional
156+
prop : `~matplotlib.font_manager.FontProperties`, optional
157157
Font property used as a reference for paddings.
158158
**kwargs
159159
Keyword arguments forwarded to `.AnchoredOffsetbox`.
160160
161161
Attributes
162162
----------
163-
ellipse : `matplotlib.patches.Ellipse`
163+
ellipse : `~matplotlib.patches.Ellipse`
164164
Ellipse patch drawn.
165165
"""
166166
self._box = AuxTransformBox(transform)
@@ -182,7 +182,7 @@ def __init__(self, transform, size, label, loc,
182182
183183
Parameters
184184
----------
185-
transform : `matplotlib.transforms.Transform`
185+
transform : `~matplotlib.transforms.Transform`
186186
The transformation object for the coordinate system in use, i.e.,
187187
:attr:`matplotlib.axes.Axes.transData`.
188188
size : float
@@ -213,7 +213,7 @@ def __init__(self, transform, size, label, loc,
213213
Color for the size bar and label.
214214
label_top : bool, default: False
215215
If True, the label will be over the size bar.
216-
fontproperties : `matplotlib.font_manager.FontProperties`, optional
216+
fontproperties : `~matplotlib.font_manager.FontProperties`, optional
217217
Font properties for the label text.
218218
fill_bar : bool, optional
219219
If True and if *size_vertical* is nonzero, the size bar will
@@ -225,15 +225,15 @@ def __init__(self, transform, size, label, loc,
225225
226226
Attributes
227227
----------
228-
size_bar : `matplotlib.offsetbox.AuxTransformBox`
228+
size_bar : `~matplotlib.offsetbox.AuxTransformBox`
229229
Container for the size bar.
230-
txt_label : `matplotlib.offsetbox.TextArea`
230+
txt_label : `~matplotlib.offsetbox.TextArea`
231231
Container for the label of the size bar.
232232
233233
Notes
234234
-----
235235
If *prop* is passed as a keyword argument, but *fontproperties* is
236-
not, then *prop* is be assumed to be the intended *fontproperties*.
236+
not, then *prop* is assumed to be the intended *fontproperties*.
237237
Using both *prop* and *fontproperties* is not supported.
238238
239239
Examples
@@ -301,7 +301,7 @@ def __init__(self, transform, label_x, label_y, length=0.15,
301301
302302
Parameters
303303
----------
304-
transform : `matplotlib.transforms.Transform`
304+
transform : `~matplotlib.transforms.Transform`
305305
The transformation object for the coordinate system in use, i.e.,
306306
:attr:`matplotlib.axes.Axes.transAxes`.
307307
label_x, label_y : str
@@ -335,7 +335,7 @@ def __init__(self, transform, label_x, label_y, length=0.15,
335335
sep_x, sep_y : float, default: 0.01 and 0 respectively
336336
Separation between the arrows and labels in coordinates of
337337
*transform*.
338-
fontproperties : `matplotlib.font_manager.FontProperties`, optional
338+
fontproperties : `~matplotlib.font_manager.FontProperties`, optional
339339
Font properties for the label text.
340340
back_length : float, default: 0.15
341341
Fraction of the arrow behind the arrow crossing.
@@ -347,25 +347,25 @@ def __init__(self, transform, label_x, label_y, length=0.15,
347347
Width of arrow tail, sent to ArrowStyle.
348348
text_props, arrow_props : dict
349349
Properties of the text and arrows, passed to
350-
`.textpath.TextPath` and `.patches.FancyArrowPatch`.
350+
`~.textpath.TextPath` and `~.patches.FancyArrowPatch`.
351351
**kwargs
352352
Keyword arguments forwarded to `.AnchoredOffsetbox`.
353353
354354
Attributes
355355
----------
356-
arrow_x, arrow_y : `matplotlib.patches.FancyArrowPatch`
356+
arrow_x, arrow_y : `~matplotlib.patches.FancyArrowPatch`
357357
Arrow x and y
358-
text_path_x, text_path_y : `matplotlib.textpath.TextPath`
358+
text_path_x, text_path_y : `~matplotlib.textpath.TextPath`
359359
Path for arrow labels
360-
p_x, p_y : `matplotlib.patches.PathPatch`
360+
p_x, p_y : `~matplotlib.patches.PathPatch`
361361
Patch for arrow labels
362-
box : `matplotlib.offsetbox.AuxTransformBox`
362+
box : `~matplotlib.offsetbox.AuxTransformBox`
363363
Container for the arrows and labels.
364364
365365
Notes
366366
-----
367367
If *prop* is passed as a keyword argument, but *fontproperties* is
368-
not, then *prop* is be assumed to be the intended *fontproperties*.
368+
not, then *prop* is assumed to be the intended *fontproperties*.
369369
Using both *prop* and *fontproperties* is not supported.
370370
371371
Examples

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,14 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
237237

238238
def new_locator(self, nx, ny, nx1=None, ny1=None):
239239
"""
240-
Return a new `AxesLocator` for the specified cell.
240+
Return a new `.AxesLocator` for the specified cell.
241241
242242
Parameters
243243
----------
244244
nx, nx1 : int
245245
Integers specifying the column-position of the
246246
cell. When *nx1* is None, a single *nx*-th column is
247-
specified. Otherwise location of columns spanning between *nx*
247+
specified. Otherwise, location of columns spanning between *nx*
248248
to *nx1* (but excluding *nx1*-th column) is specified.
249249
ny, ny1 : int
250250
Same as *nx* and *nx1*, but for row positions.
@@ -275,7 +275,7 @@ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
275275
276276
Parameters
277277
----------
278-
use_axes : `~.axes.Axes` or list of `~.axes.Axes`
278+
use_axes : `~matplotlib.axes.Axes` or list of `~matplotlib.axes.Axes`
279279
The Axes whose decorations are taken into account.
280280
pad : float, optional
281281
Additional padding in inches.
@@ -291,18 +291,18 @@ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
291291
class AxesLocator:
292292
"""
293293
A callable object which returns the position and size of a given
294-
AxesDivider cell.
294+
`.AxesDivider` cell.
295295
"""
296296

297297
def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
298298
"""
299299
Parameters
300300
----------
301-
axes_divider : AxesDivider
301+
axes_divider : `~mpl_toolkits.axes_grid1.axes_divider.AxesDivider`
302302
nx, nx1 : int
303303
Integers specifying the column-position of the
304304
cell. When *nx1* is None, a single *nx*-th column is
305-
specified. Otherwise location of columns spanning between *nx*
305+
specified. Otherwise, location of columns spanning between *nx*
306306
to *nx1* (but excluding *nx1*-th column) is specified.
307307
ny, ny1 : int
308308
Same as *nx* and *nx1*, but for row positions.
@@ -359,7 +359,7 @@ def __init__(self, fig, *args, horizontal=None, vertical=None,
359359
"""
360360
Parameters
361361
----------
362-
fig : `matplotlib.figure.Figure`
362+
fig : `~matplotlib.figure.Figure`
363363
364364
*args : tuple (*nrows*, *ncols*, *index*) or int
365365
The array of subplots in the figure has dimensions ``(nrows,
@@ -611,7 +611,7 @@ def _locate(x, y, w, h, summed_widths, equal_heights, fig_w, fig_h, anchor):
611611

612612
class HBoxDivider(SubplotDivider):
613613
"""
614-
A `SubplotDivider` for laying out axes horizontally, while ensuring that
614+
A `.SubplotDivider` for laying out axes horizontally, while ensuring that
615615
they have equal heights.
616616
617617
Examples
@@ -621,14 +621,14 @@ class HBoxDivider(SubplotDivider):
621621

622622
def new_locator(self, nx, nx1=None):
623623
"""
624-
Create a new `AxesLocator` for the specified cell.
624+
Create a new `.AxesLocator` for the specified cell.
625625
626626
Parameters
627627
----------
628628
nx, nx1 : int
629629
Integers specifying the column-position of the
630630
cell. When *nx1* is None, a single *nx*-th column is
631-
specified. Otherwise location of columns spanning between *nx*
631+
specified. Otherwise, location of columns spanning between *nx*
632632
to *nx1* (but excluding *nx1*-th column) is specified.
633633
"""
634634
return AxesLocator(self, nx, 0, nx1 if nx1 is not None else nx + 1, 1)
@@ -654,20 +654,20 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
654654

655655
class VBoxDivider(SubplotDivider):
656656
"""
657-
A `SubplotDivider` for laying out axes vertically, while ensuring that they
658-
have equal widths.
657+
A `.SubplotDivider` for laying out axes vertically, while ensuring that
658+
they have equal widths.
659659
"""
660660

661661
def new_locator(self, ny, ny1=None):
662662
"""
663-
Create a new `AxesLocator` for the specified cell.
663+
Create a new `.AxesLocator` for the specified cell.
664664
665665
Parameters
666666
----------
667667
ny, ny1 : int
668668
Integers specifying the row-position of the
669669
cell. When *ny1* is None, a single *ny*-th row is
670-
specified. Otherwise location of rows spanning between *ny*
670+
specified. Otherwise, location of rows spanning between *ny*
671671
to *ny1* (but excluding *ny1*-th row) is specified.
672672
"""
673673
return AxesLocator(self, 0, ny, 1, ny1 if ny1 is not None else ny + 1)
@@ -704,7 +704,7 @@ def make_axes_area_auto_adjustable(
704704
"""
705705
Add auto-adjustable padding around *ax* to take its decorations (title,
706706
labels, ticks, ticklabels) into account during layout, using
707-
`Divider.add_auto_adjustable_area`.
707+
`.Divider.add_auto_adjustable_area`.
708708
709709
By default, padding is determined from the decorations of *ax*.
710710
Pass *use_axes* to consider the decorations of other Axes instead.

lib/mpl_toolkits/axes_grid1/axes_rgb.py

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, **kwargs):
88
"""
99
Parameters
1010
----------
11-
pad : float
12-
Fraction of the axes height.
11+
ax : `~matplotlib.axes.Axes`
12+
Axes instance to create the RGB Axes in.
13+
pad : float, optional
14+
Fraction of the Axes height to pad.
15+
axes_class : `matplotlib.axes.Axes` or None, optional
16+
Axes class to use for the R, G, and B Axes. If None, use
17+
the same class as *ax*.
18+
**kwargs :
19+
Forwarded to *axes_class* init for the R, G, and B Axes.
1320
"""
1421

1522
divider = make_axes_locatable(ax)
@@ -55,7 +62,7 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, **kwargs):
5562

5663
class RGBAxes:
5764
"""
58-
4-panel imshow (RGB, R, G, B).
65+
4-panel `~.Axes.imshow` (RGB, R, G, B).
5966
6067
Layout:
6168
@@ -72,13 +79,13 @@ class RGBAxes:
7279
Attributes
7380
----------
7481
RGB : ``_defaultAxesClass``
75-
The axes object for the three-channel imshow.
82+
The Axes object for the three-channel `~.Axes.imshow`.
7683
R : ``_defaultAxesClass``
77-
The axes object for the red channel imshow.
84+
The Axes object for the red channel `~.Axes.imshow`.
7885
G : ``_defaultAxesClass``
79-
The axes object for the green channel imshow.
86+
The Axes object for the green channel `~.Axes.imshow`.
8087
B : ``_defaultAxesClass``
81-
The axes object for the blue channel imshow.
88+
The Axes object for the blue channel `~.Axes.imshow`.
8289
"""
8390

8491
_defaultAxesClass = Axes
@@ -88,13 +95,13 @@ def __init__(self, *args, pad=0, **kwargs):
8895
Parameters
8996
----------
9097
pad : float, default: 0
91-
fraction of the axes height to put as padding.
92-
axes_class : matplotlib.axes.Axes
93-
98+
Fraction of the Axes height to put as padding.
99+
axes_class : `~matplotlib.axes.Axes`
100+
Axes class to use. If not provided ``_defaultAxesClass`` is used.
94101
*args
95-
Unpacked into axes_class() init for RGB
102+
Forwarded to *axes_class* init for the RGB Axes
96103
**kwargs
97-
Unpacked into axes_class() init for RGB, R, G, B axes
104+
Forwarded to *axes_class* init for the RGB, R, G, and B Axes
98105
"""
99106
axes_class = kwargs.pop("axes_class", self._defaultAxesClass)
100107
self.RGB = ax = axes_class(*args, **kwargs)
@@ -114,15 +121,15 @@ def imshow_rgb(self, r, g, b, **kwargs):
114121
----------
115122
r, g, b : array-like
116123
The red, green, and blue arrays.
117-
kwargs : imshow kwargs
118-
kwargs get unpacked into the imshow calls for the four images.
124+
**kwargs :
125+
Forwarded to `~.Axes.imshow` calls for the four images.
119126
120127
Returns
121128
-------
122-
rgb : matplotlib.image.AxesImage
123-
r : matplotlib.image.AxesImage
124-
g : matplotlib.image.AxesImage
125-
b : matplotlib.image.AxesImage
129+
rgb : `~matplotlib.image.AxesImage`
130+
r : `~matplotlib.image.AxesImage`
131+
g : `~matplotlib.image.AxesImage`
132+
b : `~matplotlib.image.AxesImage`
126133
"""
127134
if not (r.shape == g.shape == b.shape):
128135
raise ValueError(

0 commit comments

Comments
 (0)