MATLAB: Contour lines over contourf 2D matrix

2dcontourcontourflinesmatrix

I would like to plot thick lines where y = n as a contour line on top of a contourf plot (like the image attached). How can I do this?
I have 3 Matrices I use to contourf: xi,yi,zi – all same dimensions (200×100). I want to use zi data to create the superimposed contours. I do not wish to set the levels within contourf as this is not useful for what I wish to do. I would like to control the contours completely seperate.
For an extra bonus point, it will be nice to have corresponding labels.

Best Answer

Use the hold function, and plot only the lines of interest using a second call to the contour (not contourf) function.
See the contour documentation for Display Single Contour Line for details.