Plotting an array with pcolormesh with x and y data removes a row of the data
To illustrate what I mean, see the following:
data = np.random.random([
The behaviour you see is expected. The pcolor documentation states for
pcolor(X, Y, C, **kwargs)
:
Ideally the dimensions of X and Y should be one greater than those of C; if the dimensions are the same, then the last row and column of C will be ignored.
The same is of course true for pcolormesh
.
I'm not sure if this is the place to discuss whether this behaviour is a "quirk", but the underlying idea is that the grid defines the edges of the colored faces. Just as on a number line you have n
numbers and n-1
intervals in between.
It actually makes sense to define the edges by the grid, because pcolormesh
also allows for unequally spaced grids which would be impossible to define otherwise.