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([5,5])
plt.pcolormesh(data)
results in this 5x5 grid:
But if I want to define the x an y axes for the data like this, pcolormesh creates a 4x4 grid, with the top and right rows missing...
plt.pcolormesh(range(5), range(5), data)
In order to get the full 5x5 plot, I have to do
plt.pcolormesh(range(6), range(6), data)
Is this just a quirk of pcolormesh? Or can someone explain the reasoning why pcolormesh behaves this way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…