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

Skip to content

Commit df6f957

Browse files
committed
Improve mpl_toolkit documentation
1 parent 231d1c8 commit df6f957

File tree

12 files changed

+411
-171
lines changed

12 files changed

+411
-171
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
@@ -236,14 +236,14 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
236236

237237
def new_locator(self, nx, ny, nx1=None, ny1=None):
238238
"""
239-
Return a new `AxesLocator` for the specified cell.
239+
Return a new `.AxesLocator` for the specified cell.
240240
241241
Parameters
242242
----------
243243
nx, nx1 : int
244244
Integers specifying the column-position of the
245245
cell. When *nx1* is None, a single *nx*-th column is
246-
specified. Otherwise location of columns spanning between *nx*
246+
specified. Otherwise, location of columns spanning between *nx*
247247
to *nx1* (but excluding *nx1*-th column) is specified.
248248
ny, ny1 : int
249249
Same as *nx* and *nx1*, but for row positions.
@@ -274,7 +274,7 @@ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
274274
275275
Parameters
276276
----------
277-
use_axes : `~.axes.Axes` or list of `~.axes.Axes`
277+
use_axes : `~matplotlib.axes.Axes` or list of `~matplotlib.axes.Axes`
278278
The Axes whose decorations are taken into account.
279279
pad : float, optional
280280
Additional padding in inches.
@@ -290,18 +290,18 @@ def add_auto_adjustable_area(self, use_axes, pad=0.1, adjust_dirs=None):
290290
class AxesLocator:
291291
"""
292292
A callable object which returns the position and size of a given
293-
AxesDivider cell.
293+
`.AxesDivider` cell.
294294
"""
295295

296296
def __init__(self, axes_divider, nx, ny, nx1=None, ny1=None):
297297
"""
298298
Parameters
299299
----------
300-
axes_divider : AxesDivider
300+
axes_divider : `~mpl_toolkits.axes_grid1.axes_divider.AxesDivider`
301301
nx, nx1 : int
302302
Integers specifying the column-position of the
303303
cell. When *nx1* is None, a single *nx*-th column is
304-
specified. Otherwise location of columns spanning between *nx*
304+
specified. Otherwise, location of columns spanning between *nx*
305305
to *nx1* (but excluding *nx1*-th column) is specified.
306306
ny, ny1 : int
307307
Same as *nx* and *nx1*, but for row positions.
@@ -355,7 +355,7 @@ def __init__(self, fig, *args, horizontal=None, vertical=None,
355355
"""
356356
Parameters
357357
----------
358-
fig : `matplotlib.figure.Figure`
358+
fig : `~matplotlib.figure.Figure`
359359
360360
*args : tuple (*nrows*, *ncols*, *index*) or int
361361
The array of subplots in the figure has dimensions ``(nrows,
@@ -601,7 +601,7 @@ def _locate(x, y, w, h, summed_widths, equal_heights, fig_w, fig_h, anchor):
601601

602602
class HBoxDivider(SubplotDivider):
603603
"""
604-
A `SubplotDivider` for laying out axes horizontally, while ensuring that
604+
A `.SubplotDivider` for laying out axes horizontally, while ensuring that
605605
they have equal heights.
606606
607607
Examples
@@ -611,14 +611,14 @@ class HBoxDivider(SubplotDivider):
611611

612612
def new_locator(self, nx, nx1=None):
613613
"""
614-
Create a new `AxesLocator` for the specified cell.
614+
Create a new `.AxesLocator` for the specified cell.
615615
616616
Parameters
617617
----------
618618
nx, nx1 : int
619619
Integers specifying the column-position of the
620620
cell. When *nx1* is None, a single *nx*-th column is
621-
specified. Otherwise location of columns spanning between *nx*
621+
specified. Otherwise, location of columns spanning between *nx*
622622
to *nx1* (but excluding *nx1*-th column) is specified.
623623
"""
624624
return AxesLocator(self, nx, 0, nx1 if nx1 is not None else nx + 1, 1)
@@ -644,20 +644,20 @@ def locate(self, nx, ny, nx1=None, ny1=None, axes=None, renderer=None):
644644

645645
class VBoxDivider(SubplotDivider):
646646
"""
647-
A `SubplotDivider` for laying out axes vertically, while ensuring that they
648-
have equal widths.
647+
A `.SubplotDivider` for laying out axes vertically, while ensuring that
648+
they have equal widths.
649649
"""
650650

651651
def new_locator(self, ny, ny1=None):
652652
"""
653-
Create a new `AxesLocator` for the specified cell.
653+
Create a new `.AxesLocator` for the specified cell.
654654
655655
Parameters
656656
----------
657657
ny, ny1 : int
658658
Integers specifying the row-position of the
659659
cell. When *ny1* is None, a single *ny*-th row is
660-
specified. Otherwise location of rows spanning between *ny*
660+
specified. Otherwise, location of rows spanning between *ny*
661661
to *ny1* (but excluding *ny1*-th row) is specified.
662662
"""
663663
return AxesLocator(self, 0, ny, 1, ny1 if ny1 is not None else ny + 1)
@@ -694,7 +694,7 @@ def make_axes_area_auto_adjustable(
694694
"""
695695
Add auto-adjustable padding around *ax* to take its decorations (title,
696696
labels, ticks, ticklabels) into account during layout, using
697-
`Divider.add_auto_adjustable_area`.
697+
`.Divider.add_auto_adjustable_area`.
698698
699699
By default, padding is determined from the decorations of *ax*.
700700
Pass *use_axes* to consider the decorations of other Axes instead.

lib/mpl_toolkits/axes_grid1/axes_rgb.py

Lines changed: 26 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)
@@ -52,7 +59,7 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, **kwargs):
5259

5360
class RGBAxes:
5461
"""
55-
4-panel imshow (RGB, R, G, B).
62+
4-panel `~.Axes.imshow` (RGB, R, G, B).
5663
5764
Layout:
5865
@@ -65,17 +72,18 @@ class RGBAxes:
6572
+---------------+-----+
6673
6774
Subclasses can override the ``_defaultAxesClass`` attribute.
75+
By default RGBAxes uses `.mpl_axes.Axes`.
6876
6977
Attributes
7078
----------
7179
RGB : ``_defaultAxesClass``
72-
The axes object for the three-channel imshow.
80+
The Axes object for the three-channel `~.Axes.imshow`.
7381
R : ``_defaultAxesClass``
74-
The axes object for the red channel imshow.
82+
The Axes object for the red channel `~.Axes.imshow`.
7583
G : ``_defaultAxesClass``
76-
The axes object for the green channel imshow.
84+
The Axes object for the green channel `~.Axes.imshow`.
7785
B : ``_defaultAxesClass``
78-
The axes object for the blue channel imshow.
86+
The Axes object for the blue channel `~.Axes.imshow`.
7987
"""
8088

8189
_defaultAxesClass = Axes
@@ -85,13 +93,13 @@ def __init__(self, *args, pad=0, **kwargs):
8593
Parameters
8694
----------
8795
pad : float, default: 0
88-
fraction of the axes height to put as padding.
89-
axes_class : matplotlib.axes.Axes
90-
96+
Fraction of the Axes height to put as padding.
97+
axes_class : `~matplotlib.axes.Axes`
98+
Axes class to use. If not provided, ``_defaultAxesClass`` is used.
9199
*args
92-
Unpacked into axes_class() init for RGB
100+
Forwarded to *axes_class* init for the RGB Axes
93101
**kwargs
94-
Unpacked into axes_class() init for RGB, R, G, B axes
102+
Forwarded to *axes_class* init for the RGB, R, G, and B Axes
95103
"""
96104
axes_class = kwargs.pop("axes_class", self._defaultAxesClass)
97105
self.RGB = ax = axes_class(*args, **kwargs)
@@ -111,15 +119,15 @@ def imshow_rgb(self, r, g, b, **kwargs):
111119
----------
112120
r, g, b : array-like
113121
The red, green, and blue arrays.
114-
kwargs : imshow kwargs
115-
kwargs get unpacked into the imshow calls for the four images.
122+
**kwargs :
123+
Forwarded to `~.Axes.imshow` calls for the four images.
116124
117125
Returns
118126
-------
119-
rgb : matplotlib.image.AxesImage
120-
r : matplotlib.image.AxesImage
121-
g : matplotlib.image.AxesImage
122-
b : matplotlib.image.AxesImage
127+
rgb : `~matplotlib.image.AxesImage`
128+
r : `~matplotlib.image.AxesImage`
129+
g : `~matplotlib.image.AxesImage`
130+
b : `~matplotlib.image.AxesImage`
123131
"""
124132
if not (r.shape == g.shape == b.shape):
125133
raise ValueError(

0 commit comments

Comments
 (0)