Skip to content Skip to sidebar Skip to footer

Matplotlib Pcolormesh Creates Data Artifacts

I'm plotting data using the matplotlib functions pcolormesh and imshow and when I use pcolormesh it produces artifacts where it seems to slide some of the data around: whereas ims

Solution 1:

The answer is, my data was not shaped correctly. pcolormesh expects the input array to have the right number of columns and rows, even if those columns and rows are full of NaNs. Thus when it finds a "gap" in the data it fills it with the last known value. The artifacts are not artifacts but gaps in the data. In my original example I had assumed imshow to be correct when in fact it is not accounting for these gaps.


Post a Comment for "Matplotlib Pcolormesh Creates Data Artifacts"