Convert QuadMesh generated by pcolormesh to an RGBA array
问题 Lets say I have the following code: import numpy as np import matplotlib.pyplot as plt x = np.arange(10) y = np.arange(10) z = np.sum(np.meshgrid(x,y), 0) qm = plt.pcolormesh(x, y, z[:-1, :-1]) qm is now a QuadMesh object. Now, I want to covert this QuadMesh to an RGBA array, in this case a 9x9x4 array giving the red, green, blue, and alpha values at each point. The QuadmEsh object does have a to_rgba() subroutine, but I am having trouble interpreting the documentation. to_rgba() requires