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

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

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

Initial import of Stark code.

Line 
1   function H = mtitle(ax,l1,l2)
2   % MTITLE places a two-line title on the figure.
3   %
4   % MTITLE(L1,L2) place a two-line title on the
5   % plot.  L1 is the first line, L2 is the second.
6   %
7   % MTITLE(AX,L1,L2) places the title above the
8   % axes AX.  AX is the handle to the axes.
9 %
10 % Calls: none
11
12   % John L. Galenski III
13   % Copyright by The MathWorks, Inc.  1994
14
15   if nargin ~= 2
16     error('MTITLE requires 2 inputs.')
17   end
18   if nargin == 2
19     l2 = l1;
20     l1 = ax;
21     ax = gca;
22   end
23   axes(ax)
24
25   % Determine the location of the title
26   title(' ')
27   T = get(ax,'Title');
28   Tu = get(T,'Units');
29   set(T,'Units','normal')
30   PT = get(T,'Extent');
31   set(T,'Units',Tu)
32   X = PT(1);
33   Y = PT(2);
34   H = PT(4);
35
36   % Place the titles
37   h = text('Units','normal','Position',[X,Y+H,0], ...
38       'Clipping','off','VerticalAlignment','bottom', ...
39       'HorizontalAlignment','center','String',l1);
40
41   h(2) = text('Units','normal','Position',[X,Y+H,0], ...
42       'Clipping','off','VerticalAlignment','top', ...
43       'HorizontalAlignment','center','String',l2);
44
45   if nargout == 1
46     H = h;
47   end
Note: See TracBrowser for help on using the browser.