Yes, it activates the input:
https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/axes/_axes.py
If you know the desired 2d form, you can unravel with a simple reshape call.
If the result should have the same form as D , use:
img.get_array().reshape(D.shape)
If the size of the bitmap C can change, this will not work.
If I create an array D that is (10,20) and build it
img = pyplot.pcolormesh(D)
img._A - (200), the array returned by img.get_array() .
img._meshHeight, img._meshWidth # 10, 20
Thus, the array can be changed as follows:
img._A.reshape(img._meshHeight, img._meshWidth)
img._coordinates is an array (11,21,2), the coordinates in the x and y direction plus one point. This way you can get C conversion information from _coordinates . I do not see any public API method for extracting these attributes, but this does not stop the "serious" Python programmers. In this test case, it generated coordinates from form D
This Quadmesh was created using
coords = np.zeros(((Nx * Ny), 2), dtype=float) coords[:, 0] = X coords[:, 1] = Y collection = QuadMesh( Nx - 1, Ny - 1, coords, ...) .... collection.set_array(C)
A search for get_array in the matplotlib github repository matplotlib not receive many hits.
I dug a little into the pcolor code. It returns PolyCollections img, not a square. It contains information for drawing a collection of quadrangles.
For example, in my 10x20 test case, img._paths is a list of 200 Path objects
In [486]: img1._paths[0] Out[486]: Path(array([[ 0., 0.], [ 0., 1.], [ 1., 1.], [ 1., 0.], [ 0., 0.], [ 0., 0.]]), array([ 1, 2, 2, 2, 2, 79], dtype=uint8))
It has five coordinate pairs, xy points, necessary to draw the border of the square, which will have a color value corresponding to C[0] (in an uninhibited form).
So, all the X Y grid information is now encoded in these Path objects. Instead of laying a grid, it displays 200 colored squares (quads). The PolyCollections code PolyCollections not assume that the squares are in any order or even touch each other. The big picture was replaced with a bunch of independent small images.
Perhaps you can collect these squares into a grid, find matching vertices, etc. But it will be a lot of work.