Allow NaN in Matplotlib pcolormesh x,y coords

Matplotlib pcolormesh() is 10-100x or more faster than pcolor(), especially when using cartopy. However, the mesh generation requires valid edge coordinates–NaN is not allowed. A workaround for certain scenarios like geospatial plots is to “smear” the last valid x,y (say, latitude, longitude) out to replace the NaN’s. Like pcolor(), this method hides the invalid values. There may be slight aberrations at the edges.

Example code for pcolormesh with NaN coordinates: