%% MAPCAPE Displays a matrix of elevation data as an image.
%
% See also: RISINGSEA, SURFCAPE, INTERPCAPE, CONTOURCAPE.
% See the MAP DATA folder for elevations in other countries.
 
%% Load the data.
load cape
% Satellite elevation data for New England, including Cape Cod.
% A pseudocolor map uses blue for zero altitude and associates
% 192 colors with 192 different elevation levels in the data. 
% Source: U.S. National Oceanic and Atmospheric Administration.

%% Plot the data as an image.
figure('Units','Normalized','Position',[0 0 1 1]) % Large figure.
image(X) % Display the image with the default MATLAB colormap (jet).
colormap(map) % Apply the colormap supplied by NOAA.
colorbar % View the level/color relationship alongside the plot.
axis image % Set the aspect ratio for equal pixel height and width. 

%% Find the position of the highest peaks, circle them, and label them.
shg % Bring current figure forward.
[m,n] = find(X == max(X(:))); %#ok
hold on
plot(n,m,'ro','MarkerSize',7,'LineWidth',2) % Note image/plot coordinate change.
text(n(1)-5,m(1)-10,'{\bf The Tripyramid}','Color','r')

%% Compare the satellite image with a map of the area.
figure('Units','Normalized','Position',[0 0 1 1]) % Large figure.
load capemap % Load a map of the area (RGB image -- no colormap).
image(capemap) 
axis image 
% Note the distortion in the map relative to the satellite image. 
% The top left corner of the satellite image corresponds to about
% the 125th row on the left side of the map. See SURFCAPE.

clear m n