def coord_to_im(xyz, shape='square'):
    """Return image from xyz coordinates as an nxm matrix"""
    z = xyz[:, (2)]
    if shape == 'square':
        l = int(xyz.shape[0] ** 0.5)
        image = z.reshape(l, l).T
        return image
    y, x = shape
    image = z.reshape(y, x)
    return image
