ny, nx = 2, 3
r, g, b = [np.random.random(ny * nx).reshape((ny, nx)) for _ in range(3)]
c = np.dstack([r, g, b])
plt.imshow(c, interpolation='nearest')
plt.show()
How to assign RGB color values to grid mesh with matplotlib