File Exchange

image thumbnail


version 1.3 (2.1 KB) by

Fills area between TWO contour levels.

1 Download


View License

The procedure sews together neighboring contour paths, and draws resulting polygon with holes in it. The paths are extracted from 'children' property of standard contourf object, because they are closed, unlike the 'contour matrix'.
If you desire 'edgecolor' other than 'none', please use standard contour procedure.

[poly ph] = contourfill(x,y, z, lev, varargin)

poly = cell array with x,y-coordinates of the closed-contour-paths
ph = handles to plot objects created by function fill
Other arguments refer to 'fill'.
 lev = [0.5 2];
 z = peaks(100);
 figure(234); clf; hold on;
 contourfill([],[], z' , lev, facecolor', 'b', 'facealpha', 0.3 );
 contourfill([],[], flipud(z), lev, 'facecolor', 'g', 'facealpha', 0.3 );
 contourfill([],[], fliplr(z), lev, 'facecolor', 'r', 'facealpha', 0.3 );

Comments and Ratings (1)

JR King

Cool function thanks. It'd be great to add an option for controlling the colors when using multiple levels.



just a typo in description corrected

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video