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

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

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

Initial import of Stark code.

Line 
1 %
2 % PAN   Mouse-driven pan-around facility.   
3 %
4 % PAN   Mouse-driven pan-around facility.  PAN prompts the user to choose
5 %       the new center of the viewing box with the left mouse button
6 %       and then shifts the view accordingly.
7 %
8 % Call as: ">> pan"
9 %
10 % Calls: none
11 %
12 %        Brian O. Blanton
13 %        Curr. in Marine Science
14 %        15-1A Venable Hall
15 %        CB# 3300
16 %        Uni. of North Carolina
17 %        Chapel Hill, NC
18 %                 27599-3300
19 %
20 %        919-962-4466
21 %        blanton@marine.unc.edu
22 %
23 %
24
25 % get current axis limits
26 OLDXP = get(gca,'Xlim');
27 OLDYP = get(gca,'Ylim');
28  
29 % compute width and height of axes
30 width=OLDXP(2)-OLDXP(1);
31 height=OLDYP(2)-OLDYP(1);
32 waitforbuttonpress;
33 Pt1=get(gca,'CurrentPoint');
34 xcen=Pt1(1,1);
35 ycen=Pt1(1,2);
36
37 % compute new window extent
38 xmin=xcen-width/2;
39 xmax=xcen+width/2;
40 ymin=ycen-height/2;
41 ymax=ycen+height/2;
42
43 % set new axis limits
44 set(gca,'Xlim',[xmin xmax]);
45 set(gca,'Ylim',[ymin ymax]);
46 clear OLDXP OLDYP width height xcen ycen xmin xmax ymin ymax
47
48
49
Note: See TracBrowser for help on using the browser.