1 |
%----------------------------------------------------------------------- |
---|
2 |
% [smin,smax,ibw,copt]=colorcontour_fe(in,x,y,bnd,scalar,smin,smax,ibw,copt) |
---|
3 |
% This function creates a color plot of data using |
---|
4 |
% Matlab5.1 commands |
---|
5 |
%----------------------------------------------------------------------- |
---|
6 |
function [smin,smax,ibw,copt]=colorcontour_fe(in,x,y,bnd,scalar,smin,smax,ibw,copt) |
---|
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 contour levels (if 5 arguments are sent to function) |
---|
13 |
% |
---|
14 |
if nargin == 5 |
---|
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 |
clear cval; |
---|
20 |
clear cmap; |
---|
21 |
cval=smin:ibw:smax; |
---|
22 |
ncon=length(cval); |
---|
23 |
if nargin < 9 |
---|
24 |
copt=input('Black, gray scale or color spectrum color map (b/g/c)? ','s'); |
---|
25 |
end |
---|
26 |
% |
---|
27 |
% Set colormap |
---|
28 |
% |
---|
29 |
if copt=='c' |
---|
30 |
cmapjet=jet; |
---|
31 |
size(cmapjet); |
---|
32 |
njet=ans(1); |
---|
33 |
for i=1:ncon |
---|
34 |
cmap(i,:)=cmapjet(1+round((njet-1)*(i-1)/(ncon-1)),:); |
---|
35 |
end |
---|
36 |
elseif copt=='g' |
---|
37 |
for i=1:ncon |
---|
38 |
cmap(i,1)=i/(2.0*ncon); |
---|
39 |
cmap(i,2)=cmap(i,1); |
---|
40 |
cmap(i,3)=cmap(i,1); |
---|
41 |
end |
---|
42 |
cmap=max(cmap,0.0); |
---|
43 |
cmap=min(cmap,1.0); |
---|
44 |
else |
---|
45 |
for i=1:ncon |
---|
46 |
cmap(i,1)=0.0; |
---|
47 |
cmap(i,2)=cmap(i,1); |
---|
48 |
cmap(i,3)=cmap(i,1); |
---|
49 |
end |
---|
50 |
end |
---|
51 |
% |
---|
52 |
% Generate plot |
---|
53 |
% |
---|
54 |
bndo=plotbnd(x,y,bnd); |
---|
55 |
set(bndo,'Color','k') |
---|
56 |
hc=lcontour2(in,x,y,scalar,cval); |
---|
57 |
set(hc,'LineWidth',1.0); |
---|
58 |
for i=1:ncon |
---|
59 |
set(hc(i),'color',cmap(i,:)); |
---|
60 |
end |
---|
61 |
set(hc(1),'LineStyle','-.'); |
---|
62 |
xlabel([num2str(smin),'(-.) to ',num2str(smax),' by ',num2str(ibw)]); |
---|