MATLAB Examples

alt_4_50d.m

Filled contour of galaxy data with yellow to red colormap

load galaxy

contourValue = 1420:20:1780;
contourLabel = 1440:40:1760;
alpha = 0.25;
lambda = 2;

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

% Make filled contour plot
contourf(newx,newy,newz,contourValue);
xlabel('East-West Coordinate (arcsec)')
ylabel('North-South Coordinate (arcsec)')
title('Stellar Velocity')
axis image
colormap(autumn)
mymap = colormap;
colormap(flipud(mymap))

% Plot data locations.
hold on
hg = plot(EastWest,NorthSouth,'k.');
set(hg,'MarkerSize',5)
hold off
hgb = colorbar;
set(hgb,'YDir','reverse')
% pos = get(hgb,'Position');
% pos(2) = 1.21*pos(2);
% pos(4) = 0.95*pos(4);
% set(hgb,'Position',pos)
set(get(hgb,'XLabel'),'String','km/sec')