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

root/gliderproc/trunk/MATLAB/plots/stickplot.m

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

Initial import of Stark code.

Line 
1 function h=stickplot(t,u,v,ax)
2 %STICKPLOT plot timeseries of a vector
3 % STICKPLOT plots a timeseries of direction vectors on the
4 % current axes.
5 %
6 %  Input: time - time vector
7 %         u    - east/west component of the vector series
8 %         v    - north/south component of the vector series
9 %         ax   - a 4x1 vector indicating the region of the
10 %                time series to zoom in on.  This is necessary
11 %                for the proper scaling of the direction and
12 %                magnitude of the vectors.
13 % Output: h    - handle to the line object drawn           
14 %           
15 % NOTE: do not resize the window or axes AFTER STICKPLOT
16 %       has drawn the vectors.  The east/west north/south
17 %       magnitudes will no longer be scaled correctly.
18 %
19 %
20 % Calls: none
21 % Written by : Brian O. Blanton
22 % Fall 1997
23
24
25 axis(ax);   
26 pos = get(gca,'Position');
27 pap = get(gcf,'PaperPosition');
28 hwratio = (pos(4)*pap(4))/(pos(3)*pap(3));
29              
30 dt = ax(2)-ax(1);
31 dv = ax(4)-ax(3);
32 sf = hwratio*dt/dv;
33 s = [0; 1; 0];
34 n = length(t);
35 us = u*sf;   
36 vec = zeros( n*3, 2 );
37 id = (1:3');
38 for i=1:n   
39    vec(id,:) = s*[us(i), v(i)];
40    vec(id,1) = vec(id,1)+ones(3,1)*t(i);
41    id = id+3;
42 end         
43              
44 h=line(vec(:,1),vec(:,2));
45 if nargout==1,hstick=h;,end
46 axis(ax)     
47
48 %
49 %        Brian O. Blanton
50 %        Department of Marine Sciences
51 %        15-1A Venable Hall
52 %        CB# 3300
53 %        Uni. of North Carolina
54 %        Chapel Hill, NC
55 %                 27599-3300
56 %
57 %        919-962-4466
58 %        blanton@marine.unc.edu
59 %
60 %        Fall 1997
Note: See TracBrowser for help on using the browser.