File Exchange

image thumbnail

nanContourf(xb,yb,x​,y,z)

version 1.3.2.0 (2.81 KB) by benoit
contourf with nans filled in precisely

2 Downloads

Updated 03 Sep 2015

View License

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!

Comments and Ratings (0)

Updates

1.3.2.0

cleaned description of function and code

1.3.1.0

commented and simplified code a bit

1.3.0.0

changed a lot. Now fills the nan boxes individually. This enables to deal with 'lakes' but creates a problem when printing to eps.

1.1.0.0

just got rid of the v2 in the top right sublot

1.1.0.0

Added an extrapolation (inpaint_nans) to get rid of the white borders of nans.

1.0.0.0

added the fact it does not work for 'lakes'

MATLAB Release Compatibility
Created with R2012a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired by: inpaint_nans