8000 Merge pull request #7826 from anntzer/invalid-rgbaxes-dimensions-check · matplotlib/matplotlib@2da8a98 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2da8a98

Browse files
efiringQuLogic
authored andcommitted
Merge pull request #7826 from anntzer/invalid-rgbaxes-dimensions-check
Remove invalid dimension checking in axes_rgb.
1 parent de8c311 commit 2da8a98

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lib/mpl_toolkits/axes_grid1/axes_rgb.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,23 +202,20 @@ def imshow_rgb(self, r, g, b, **kwargs):
202202
g : matplotlib.image.AxesImage
203203
b : matplotlib.image.AxesImage
204204
"""
205-
ny, nx = r.shape
206-
if not ((nx, ny) == g.shape == b.shape):
205+
if not (r.shape == g.shape == b.shape):
207206
raise ValueError('Input shapes do not match.'
208-
'\nr.shape = {0}'
209-
'\ng.shape = {1}'
210-
'\nb.shape = {2}'
211-
''.format(r.shape, g.shape, b.shape))
212-
213-
R = np.zeros([ny, nx, 3], dtype="d")
207+
'\nr.shape = {}'
208+
'\ng.shape = {}'
209+
'\nb.shape = {}'
210+
.format(r.shape, g.shape, b.shape))
211+
RGB = np.dstack([r, g, b])
212+
R = np.zeros_like(RGB)
214213
R[:,:,0] = r
215-
G = np.zeros_like(R)
214+
G = np.zeros_like(RGB)
216215
G[:,:,1] = g
217-
B = np.zeros_like(R)
216+
B = np.zeros_like(RGB)
218217
B[:,:,2] = b
219218

220-
RGB = R + G + B
221-
222219
im_rgb = self.RGB.imshow(RGB, **kwargs)
223220
im_r = self.R.imshow(R, **kwargs)
224221
im_g = self.G.imshow(G, **kwargs)

0 commit comments

Comments
 (0)
0