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

root/gliderproc/trunk/MATLAB/opnml/FCAST_1.2/drawstick.m

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

Initial import of Stark code.

Line 
1 %
2 % DRAWSTICK draw sticks for vectors, as opposed to arrows 
3 %
4 % DRAWSTICK routine to  draw vectors as sticks.
5 %           A line eminates from the vector
6 %           origins (xo,yo) with "large" dots at the origins.
7 %           No arrow heads are drawn.  Use VECPLOT for arrow heads.
8 %
9 %           This is a fairly low-level routine in that in does no scaling
10 %           to the vectors.  This function is called primarily by STICKPLOT
11 %           and returns the handle of the vector object drawn.
12 %
13 %           All Input arguments to DRAWSTICK are required.
14 %
15 %  Inputs:  x,y     - vector origins
16 %           u,v     - vector components
17 %           dotsize - vector origin size in points (a point is 1/72 inches;
18 %                     the MATLAB default MarkerSize of 6 is approximately
19 %                     the size of a . (period))
20 %           color  - vector linecolor
21 %
22 % Outputs:  A 2-vector of handles to the sticks and dots drawn.
23 %           The first value is the handle to the dots, the second
24 %           a handle to the shafts.
25 %
26 % Call as: >> hp=drawstick(x,y,u,dotsize,color);
27 %
28 function hp=drawstick(x,y,u,v,dotsize,lcolor)
29  
30 % COLUMNATE INPUT
31 %
32 x=x(:);y=y(:);u=u(:);v=v(:);
33
34 % DRAW STICK ORIGINS AS DOTS
35 %
36 ht=line(x,y,'Marker','.','LineStyle','none','Color',lcolor,'Markersize',dotsize);
37 set(ht,'Tag','stickdots');
38
39 % COMPUTE SHAFT ENDS
40 %
41 xe = x + u;
42 ye = y + v;   
43 xe=xe(:);ye=ye(:);
44  
45 % BUILD PLOT MATRIX
46 %
47 xs=[x xe NaN*ones(size(x))]';
48 ys=[y ye NaN*ones(size(y))]';
49 xs=xs(:);
50 ys=ys(:);
51 hp=line(xs,ys,'LineStyle','-','Color',lcolor);
52 set(hp,'Tag','stickshafts');
53 hp=[ht(:);hp(:)];
54 %
55 %        Brian O. Blanton
56 %        Department of Marine Sciences
57 %        15-1A Venable Hall
58 %        CB# 3300
59 %        Uni. of North Carolna
60 %        Chapel Hill, NC
61 %                 27599-3300
62 %
63 %        919-962-4466
64 %        blanton@marine.unc.edu
65 %
66
67
Note: See TracBrowser for help on using the browser.