The function makes a contourf plot with nans filled in gray with borders. For example, if you have a map of ocean sea surface temperature, and have nans on land 'boxes', this will plot the coast nicely (see image).
Takes the same input as contourf(x,y,z), plus (xb,yb) which are the boundary coordinates of (x,y), i.e. (xb,yb) define the coordinates of the borders of the boxes.
This now works even if there are 'lakes' within the continents.
Basically it fills the nans by extrapolating using the very good inpaint_nans.m, then it plots the contourf using this filled file, then it superimposes the filling of nans, then it draws the coast line.
Only issue I have now is that when printing to eps, you can slightly see the underlying contourf between nan boxes... If anyone knows how to deal with it, let me know!
cleaned description of function and code
commented and simplified code a bit
changed a lot. Now fills the nan boxes individually. This enables to deal with 'lakes' but creates a problem when printing to eps.
just got rid of the v2 in the top right sublot
Added an extrapolation (inpaint_nans) to get rid of the white borders of nans.
added the fact it does not work for 'lakes'
Inspired by: inpaint_nans