|
CONTOURFCMAP Filled contour plot with specified colors
h = contourfcmap(x,y,z,clev,cmap,lo,hi,cbarloc)
h = contourfcmap(x,y,z,clev,cmap)
h = contourfcmap(x,y,z,clev,cmap,lo)
h = contourfcmap(x,y,z,clev,cmap,lo,hi)
This function creates a shaded contour map, similar to that created by
the contourf function. However, the relationship between a contourf plot
and it's colormap (i.e. exactly which color corresponds to each contour
interval), can often be confusing and inconsistent, in my opinion. This
function instead allows the user to specify exactly which colors to use
in each interval, and also to choose colors for regions that exceed the
contour line limits.
Input variables
x: x-coordinates of grid, following size restrictions of surf
command
y: y-coordinates of grid, following size restrictions of surf
command
z: array of data to be contoured, following size restritions
of surf command
clev: vector of length n, contour levels, must be monotonically
increasing
cmap: n-1 x 3 colormap array, specifying colors used to shade
each contour interval
lo: 1 x 3 colormap array, specifying color used for all data
falling below the first contour level. If not included or
empty, default will be to white.
hi: 1 x 3 colormap array, specifying color used for all data
falling above the last contour level. If not included or
empty, default will be to white.
cbarloc: string specifying colorbar location (see colorbar), or a
1 x 4 position vector for colorbar. If not included, no
colorbar will be created. Note that the colorbar created
is not a colorbar object, but just an axis with plotted
patches; it is for labeling only and is not linked to the
"peer axis" in any way.
Output variables:
h: 1 x 1 structure
c: contour matrix for filled contour plot
h: handle to contourgroup
cbax: handle to axis of colorbar
Example:
[x,y] = meshgrid(linspace(0,1,100));
z = peaks(100);
contourfcmap(x,y,z,[-5 -3 -2:.5:2 3 5],jet(12), ...
[.8 .8 .8], [.2 .2 .2], 'eastoutside')
contourfcmap.zip
(3.28 KB, 下载次数: 0, 售价: 2 物探币)
|
|