NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/matlab_cen/grayband_points.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 %-----------------------------------------------------------------------
2 % [smina,smaxa,ibw]=grayband_points(x,y,scalar,smina,smaxa,ibw,pointsize)
3 % This function creates a grayscale color plot of data using
4 % Matlab5.1 commands
5 %-----------------------------------------------------------------------
6 function [smina,smaxa,ibw]=grayband_points(x,y,scalar,smina,smaxa,ibw,pointsize)
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 == 3
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 size(scalar);
39 nn=ans(1);
40 for i=1:nn
41    hp=plot(x(i),y(i),'ko');
42    set(hp,'MarkerSize',pointsize/3);
43    hp=plot(x(i),y(i),'k.');
44    set(hp,'MarkerSize',pointsize);
45    iband=nband;
46    for ii=1:nband-1
47       if scalara(i) <= cvala(ii);
48          iband=ii;
49          break;
50       end
51    end
52    set(hp,'Color',cmap(iband,:));
53 end
Note: See TracBrowser for help on using the browser.