time | calls | line |
---|
| | 1 | function hh = title(varargin)
|
| | 2 | %TITLE Graph title.
|
| | 3 | % TITLE('text') adds text at the top of the current axis.
|
| | 4 | %
|
| | 5 | % TITLE('text','Property1',PropertyValue1,'Property2',PropertyValue2,...)
|
| | 6 | % sets the values of the specified properties of the title.
|
| | 7 | %
|
| | 8 | % TITLE(AX,...) adds the title to the specified axes.
|
| | 9 | %
|
| | 10 | % H = TITLE(...) returns the handle to the text object used as the title.
|
| | 11 | %
|
| | 12 | % See also XLABEL, YLABEL, ZLABEL, TEXT.
|
| | 13 |
|
| | 14 | % Copyright 1984-2013 The MathWorks, Inc.
|
| | 15 |
|
| 18 | 16 | narginchk(1,inf);
|
| | 17 |
|
| | 18 | % if the input has a title property which is a text object, use it to set
|
| | 19 | % the title on.
|
0.01 | 18 | 20 | [ax,args,nargs] = labelcheck('Title',varargin);
|
| 18 | 21 | if isempty(ax)
|
| 18 | 22 | ax = gca;
|
| 18 | 23 | args = varargin;
|
| 18 | 24 | end
|
| | 25 |
|
| 18 | 26 | if nargs > 1 && (rem(nargs-1,2) ~= 0)
|
| | 27 | error(message('MATLAB:title:InvalidNumberOfInputs'))
|
| | 28 | end
|
| | 29 |
|
| 18 | 30 | string = args{1};
|
| 18 | 31 | if isempty(string), string=''; end;
|
| 18 | 32 | pvpairs = args(2:end);
|
| | 33 |
|
| | 34 | %---Check for bypass option
|
| 18 | 35 | if isappdata(ax,'MWBYPASS_title')
|
| | 36 | h = mwbypass(ax,'MWBYPASS_title',string,pvpairs{:});
|
| | 37 |
|
| | 38 | %---Standard behavior
|
| 18 | 39 | else
|
0.26 | 18 | 40 | h = get(ax,'Title');
|
| | 41 |
|
| 18 | 42 | if graphicsversion(ax,'handlegraphics')
|
| | 43 | %Over-ride text objects default font attributes with
|
| | 44 | %the Axes' default font attributes.
|
| | 45 | set(h, 'FontAngle', get(ax, 'FontAngle'), ...
|
| | 46 | 'FontName', get(ax, 'FontName'), ...
|
| | 47 | 'FontUnits', get(ax, 'FontUnits'), ...
|
| | 48 | 'FontSize', get(ax, 'FontSize'), ...
|
| | 49 | 'FontWeight', get(ax, 'FontWeight'), ...
|
| | 50 | 'Rotation', 0);
|
| | 51 | end
|
| | 52 |
|
| 18 | 53 | set(h, 'String', string, pvpairs{:});
|
| | 54 |
|
| 18 | 55 | end
|
| | 56 |
|
| 18 | 57 | if nargout > 0
|
| | 58 | hh = h;
|
| | 59 | end
|