@@ -8,8 +8,15 @@ def make_rgb_axes(ax, pad=0.01, axes_class=None, **kwargs):
8
8
"""
9
9
Parameters
10
10
----------
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.
13
20
"""
14
21
15
22
divider = make_axes_locatable (ax )
@@ -72,31 +79,36 @@ class RGBAxes:
72
79
Attributes
73
80
----------
74
81
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`.
76
84
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`.
78
87
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`.
80
90
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`.
82
93
"""
83
94
84
95
_defaultAxesClass = Axes
85
96
86
- def __init__ (self , * args , pad = 0 , ** kwargs ):
97
+ def __init__ (self , * args , pad = 0 , axes_class = None , ** kwargs ):
87
98
"""
88
99
Parameters
89
100
----------
90
101
pad : float, default: 0
91
102
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.
94
105
*args
95
- Unpacked into axes_class() init for RGB
106
+ Forwarded to * axes_class* init for RGB
96
107
**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
98
109
"""
99
- axes_class = kwargs .pop ("axes_class" , self ._defaultAxesClass )
110
+ if axes_class is None :
111
+ axes_class = self ._defaultAxesClass
100
112
self .RGB = ax = axes_class (* args , ** kwargs )
101
113
ax .get_figure ().add_axes (ax )
102
114
self .R , self .G , self .B = make_rgb_axes (
@@ -114,15 +126,16 @@ def imshow_rgb(self, r, g, b, **kwargs):
114
126
----------
115
127
r, g, b : array-like
116
128
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.
119
132
120
133
Returns
121
134
-------
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`
126
139
"""
127
140
if not (r .shape == g .shape == b .shape ):
128
141
raise ValueError (
0 commit comments