MATLAB Examples

book_4_50.m

Contour plot after surface fit with loess2

load galaxy

%  contour plot parameters
contourValue = 1420:20:1780;
contourLabel = 1440:40:1760;
%  loess surface fit parameters
alpha = 0.25;
lambda = 2;

% Smooth and grid the data
XI = -25:4:25;
YI = (-45:4:45)';
nx = length(XI);
ny = length(YI);
newx = repmat(XI,ny,1);
newy = repmat(YI,1,nx);
newzEw = loess2(EastWest,NorthSouth,Velocity,newx,newy,alpha,lambda,1);

% Make a countour plot with labels
[c,h] = contour(newx,newy,newzEw,contourValue);
hg = clabel(c,h,contourLabel);
set(hg,'FontSize',8)
xlabel('East-West Coordinate (arcsec)')
ylabel('North-South Coordinate (arcsec)')
title('Galaxy')
axis image
colormap jet
Warning: Text handle output is not supported for managed labels.