1 |
%----------------------------------------------------------------------- |
---|
2 |
% [smin,smax,ibw]=colorband_fe_cb(in,x,y,bnd,scalar,cb,smin,smax,ibw) |
---|
3 |
% This function creates a color banded plot using |
---|
4 |
% Matlab5.1 commands and the jet color map. |
---|
5 |
%----------------------------------------------------------------------- |
---|
6 |
function [smin,smax,ibw]=colorband_fe_cb(in,x,y,bnd,scalar,cb,smin,smax,ibw) |
---|
7 |
% |
---|
8 |
% Echo scalar range to screen |
---|
9 |
% |
---|
10 |
fprintf(1,'Scalar Range: %f to %f\n',min(min(scalar)),max(max(scalar))) |
---|
11 |
% |
---|
12 |
% Set color banding settings (if 5 arguments are sent to function) |
---|
13 |
% |
---|
14 |
if nargin < 7 |
---|
15 |
smin=input('Enter min contour level desired: '); |
---|
16 |
smax=input('Enter max contour level desired: '); |
---|
17 |
ibw =input('Enter the contour interval: '); |
---|
18 |
end |
---|
19 |
% |
---|
20 |
% Set color bands |
---|
21 |
% |
---|
22 |
cval=smin:ibw:smax; |
---|
23 |
nband=(2*ibw+smax-smin)/ibw; |
---|
24 |
cmapjet=jet(64); |
---|
25 |
size(cmapjet); |
---|
26 |
njet=ans(1); |
---|
27 |
clear cmap; |
---|
28 |
cmap(1,:)=[1 1 1]; |
---|
29 |
for i=2:nband-1 |
---|
30 |
cmap(i,:)=cmapjet(1+round((njet-1)*(i-2)/(nband-3)),:); |
---|
31 |
end |
---|
32 |
cmap(nband,:)=[1 1 1]; |
---|
33 |
% |
---|
34 |
% Generate plot |
---|
35 |
% |
---|
36 |
scalara=max(scalar,smin-ibw); |
---|
37 |
scalara=min(scalar,smax+ibw); |
---|
38 |
hpb=plotbnd(x,y,bnd);set(hpb,'color','k'); |
---|
39 |
hl=lcontour2(in,x,y,scalara,cval); |
---|
40 |
hc=colormeshm(in,x,y,scalara);colormap(cmap);caxis([smin-ibw smax+ibw]); |
---|
41 |
if cb == 1 |
---|
42 |
hb=colorbar('vert');set(hb,'xtick',cval);set(hb,'ticklength',[0.05 0.025]); |
---|
43 |
end |
---|
44 |
for l=1:nband-1 |
---|
45 |
if cval(l)>=min(scalara) & cval(l)<=max(scalara) |
---|
46 |
set(hl(l),'color','k'); |
---|
47 |
end |
---|
48 |
end |
---|
49 |
set(gca,'XTick',[]); |
---|
50 |
set(gca,'YTick',[]); |
---|
51 |
drawnow; |
---|
52 |
clear cmap; |
---|