When using QuadMesh.set_array (), you need to guess the details that must be followed. If you intend to use QuadMesh with X, Y, and C, you can update the C values โโwith set_array (). But set_array does not support the same input as the constructor. Reading the source shows that you need to pass a 1d array , and what is even more puzzling is that depending on the shading you might need to cut your C array .
Edit: There is even a very old error report about the confusing array size for shading='flat' .
It means:
Using QuadMesh.set_array () with shading = 'flat'
'flat' is the default value for shading .
# preperation import numpy as np import matplotlib.pyplot as plt plt.ion() y = np.linspace(-10, 10, num=1000) x = np.linspace(-10, 10, num=1000) X, Y = np.meshgrid(x, y) C = np.ones((1000, 1000)) * float('nan')
It looks like:

Note that if you omit C = C[:-1, :-1] , you will get this broken graphic:

Using QuadMesh.set_array () with shading = 'gouraud'
# preperation (same as for 'flat') import numpy as np import matplotlib.pyplot as plt plt.ion() y = np.linspace(-10, 10, num=1000) x = np.linspace(-10, 10, num=1000) X, Y = np.meshgrid(x, y) C = np.ones((1000, 1000)) * float('nan')
If you cut the last row / column with shade = 'gouraud', you will get:
ValueError: total size of new array must be unchanged