'Set the grid for the pixel centers, and the pixel values.
*x* and *y* are monotonic 1-D ndarrays of lengths N and M,
respectively, specifying pixel centers
*A* is an (M,N) ndarray or masked array of values to be
colormapped, or a (M,N,3) RGB array, or a (M,N,4) RGBA
array.'

def set_data(self, x, y, A):

    x = np.array(x, np.float32)
    y = np.array(y, np.float32)
    A = cbook.safe_masked_invalid(A, copy=True)
    if (not ((x.ndim == y.ndim == 1) and (A.shape[0:2] == (y.shape + x.shape)))):
        raise TypeError(u"Axes    don't    match    array    shape")
    if (A.ndim not in [2, 3]):
        raise TypeError(u'Can    only    plot    2D    or    3D    data')
    if ((A.ndim == 3) and (A.shape[2] not in [1, 3, 4])):
        raise TypeError(u'3D    arrays    must    have    three    (RGB)    or    four    (RGBA)    color    components')
    if ((A.ndim == 3) and (A.shape[2] == 1)):
        A.shape = A.shape[0:2]
    self._A = A
    self._Ax = x
    self._Ay = y
    self._imcache = None
    self.stale = True
