Skip to content

Commit ab9610e

Browse files
committed
Remove invalid dimension checking in axes_rgb.
Just let `dstack` error out if dimensions don't match.
1 parent d181f63 commit ab9610e

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

lib/mpl_toolkits/axes_grid1/axes_rgb.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -202,23 +202,14 @@ 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):
207-
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")
205+
RGB = np.dstack([r, g, b])
206+
R = np.zeros_like(RGB)
214207
R[:,:,0] = r
215-
G = np.zeros_like(R)
208+
G = np.zeros_like(RGB)
216209
G[:,:,1] = g
217-
B = np.zeros_like(R)
210+
B = np.zeros_like(RGB)
218211
B[:,:,2] = b
219212

220-
RGB = R + G + B
221-
222213
im_rgb = self.RGB.imshow(RGB, **kwargs)
223214
im_r = self.R.imshow(R, **kwargs)
224215
im_g = self.G.imshow(G, **kwargs)

0 commit comments

Comments
 (0)