8000 Improve mpl_toolkit documentation · matplotlib/matplotlib@e88ef90 · GitHub
[go: up one dir, main page]

Skip to content

Commit e88ef90

Browse files
committed
Improve mpl_toolkit documentation
1 parent 9e6afd6 commit e88ef90

File tree

7 files changed

+346
-103
lines changed

7 files changed

+346
-103
lines changed

lib/mpl_toolkits/axes_grid1/axes_divider.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,14 @@ 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 : `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
@@ -359,7 +359,7 @@ def __init__(self, fig, *args, horizontal=None, vertical=None,
359359
"""
360360
Parameters
361361
----------
362-
fig : `matplotlib.figure.Figure`
362+
fig : `~.figure.Figure`
363363
364364
*args : tuple (*nrows*, *ncols*, *index*) or int
365365
The array of subplots in the figure has dimensions ``(nrows,

lib/mpl_toolkits/axes_grid1/axes_rgb.py

Lines changed: 31 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, default: 0.01
14+
Fraction of the axes height to pad.
15+
axes_class : `~.axes.Axes` or None, default: None
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 R, G, and B axes.
1320
"""
1421

1522
divider = make_axes_locatable(ax)
@@ -72,31 +79,36 @@ class RGBAxes:
7279
Attributes
7380
----------
7481
RGB : ``_defaultAxesClass``
75-
The axes object for the three-channel imshow.
82+
The `matplotlib.axes.Axes` object for the three-channel
83+
`matplotlib.axes.Axes.imshow`.
7684
R : ``_defaultAxesClass``
77-
The axes object for the red channel imshow.
85+
The `matplotlib.axes.Axes` object for the red channel
86+
`matplotlib.axes.Axes.imshow`.
7887
G : ``_defaultAxesClass``
79-
The axes object for the green channel imshow.
88+
The `matplotlib.axes.Axes` object for the green channel
89+
`matplotlib.axes.Axes.imshow`.
8090
B : ``_defaultAxesClass``
81-
The axes object for the blue channel imshow.
91+
The `matplotlib.axes.Axes` object for the blue channel
92+
`matplotlib.axes.Axes.imshow`.
8293
"""
8394

8495
_defaultAxesClass = Axes
8596

86-
def __init__(self, *args, pad=0, **kwargs):
97+
def __init__(self, *args, pad=0, axes_class=None, **kwargs):
8798
"""
8899
Parameters
89100
----------
90101
pad : float, default: 0
91102
fraction of the axes height to put as padding.
92-
axes_class : matplotlib.axes.Axes
93-
103+
axes_class : `matplotlib.axes.Axes`
104+
Axes class to use. If not provided ``_defaultAxesClass`` is used.
94105
*args
95-
Unpacked into axes_class() init for RGB
106+
Forwarded to *axes_class* init for RGB
96107
**kwargs
97-
Unpacked into axes_class() init for RGB, R, G, B axes
108+
Forwarded to *axes_class* init for RGB, R, G, B axes
98109
"""
99-
axes_class = kwargs.pop("axes_class", self._defaultAxesClass)
110+
if axes_class is None:
111+
axes_class = self._defaultAxesClass
100112
self.RGB = ax = axes_class(*args, **kwargs)
101113
ax.get_figure().add_axes(ax)
102114
self.R, self.G, self.B = make_rgb_axes(
@@ -114,15 +126,16 @@ def imshow_rgb(self, r, g, b, **kwargs):
114126
----------
115127
r, g, b : array-like
116128
The red, green, and blue arrays.
117-
kwargs : imshow kwargs
118-
kwargs get unpacked into the imshow calls for the four images.
129+
**kwargs :
130+
Forwarded to `matplotlib.axes.Axes.imshow` calls for the four
131+
images.
119132
120133
Returns
121134
-------
122-
rgb : matplotlib.image.AxesImage
123-
r : matplotlib.image.AxesImage
124-
g : matplotlib.image.AxesImage
125-
b : matplotlib.image.AxesImage
135+
rgb : `matplotlib.image.AxesImage`
136+
r : `matplotlib.image.AxesImage`
137+
g : `matplotlib.image.AxesImage`
138+
b : `matplotlib.image.AxesImage`
126139
"""
127140
if not (r.shape == g.shape == b.shape):
128141
raise ValueError(

0 commit comments

Comments
 (0)
0