1 |
%----------------------------------------------------------------------- |
---|
2 |
% [smina,smaxa,ibw]=grayband_fe(in,x,y,bnd,scalar,smina,smaxa,ibw) |
---|
3 |
% This function creates a grayscale color banded plot using |
---|
4 |
% Matlab5.1 commands |
---|
5 |
%----------------------------------------------------------------------- |
---|
6 |
function [smina,smaxa,ibw]=grayband_fe(in,x,y,bnd,scalar,smina,smaxa,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 == 5 |
---|
15 |
smina=input('Enter min contour level desired: '); |
---|
16 |
smaxa=input('Enter max contour level desired: '); |
---|
17 |
ibw =input('Enter the contour interval: '); |
---|
18 |
end |
---|
19 |
cvala=smina:ibw:smaxa; |
---|
20 |
nband=(2*ibw+smaxa-smina)/ibw; |
---|
21 |
clear cmap; |
---|
22 |
for i=1:nband |
---|
23 |
cmap(i,1)=(i-1)/(nband-1); |
---|
24 |
cmap(i,2)=cmap(i,1); |
---|
25 |
cmap(i,3)=cmap(i,1); |
---|
26 |
end |
---|
27 |
cmap=max(cmap,0.0); |
---|
28 |
cmap=min(cmap,1.0); |
---|
29 |
invert='y'; |
---|
30 |
if invert == 'y' |
---|
31 |
cmap=1-cmap; |
---|
32 |
end |
---|
33 |
% |
---|
34 |
% Generate plot |
---|
35 |
% |
---|
36 |
scalara=max(scalar,smina-ibw); |
---|
37 |
scalara=min(scalar,smaxa+ibw); |
---|
38 |
hpb=plotbnd(x,y,bnd);set(hpb,'color','k'); |
---|
39 |
hl=lcontour2(in,x,y,scalara,cvala); |
---|
40 |
hc=colormeshm(in,x,y,scalara);colormap(cmap);caxis([smina-ibw smaxa+ibw]); |
---|
41 |
hb=colorbar;set(hb,'ytick',cvala);set(hb,'ticklength',[0.05 0.025]); |
---|
42 |
set(hb,'FontSize',1.0) |
---|
43 |
for l=1:nband-1 |
---|
44 |
if cvala(l)>=min(scalara) & cvala(l)<=max(scalara) |
---|
45 |
set(hl(l),'color','k'); |
---|
46 |
end |
---|
47 |
end |
---|
48 |
% |
---|
49 |
% Label x-axis with range of input data |
---|
50 |
% |
---|
51 |
xlabel(['Scalar Range: ',num2str(min(min(scalar))),' to ',num2str(max(max(scalar)))]) |
---|