time | Calls | line |
---|
| | 1 | function hh = xlabel(varargin)
|
| | 2 | %XLABEL X-axis label.
|
| | 3 | % XLABEL('text') adds text beside the X-axis on the current axis.
|
| | 4 | %
|
| | 5 | % XLABEL('text','Property1',PropertyValue1,'Property2',PropertyValue2,...)
|
| | 6 | % sets the values of the specified properties of the xlabel.
|
| | 7 | %
|
| | 8 | % XLABEL(AX,...) adds the xlabel to the specified axes.
|
| | 9 | %
|
| | 10 | % H = XLABEL(...) returns the handle to the text object used as the label.
|
| | 11 | %
|
| | 12 | % See also YLABEL, ZLABEL, TITLE, TEXT.
|
| | 13 |
|
| | 14 | % Copyright 1984-2017 The MathWorks, Inc.
|
| | 15 |
|
| | 16 | % if the input has an xlabel property which is a text object, use it to set
|
| | 17 | % the xlabel on.
|
< 0.001 | 2 | 18 | [ax,args,nargs] = labelcheck('XLabel',varargin);
|
| | 19 |
|
< 0.001 | 2 | 20 | if nargs == 0 || (nargs > 1 && (rem(nargs-1,2) ~= 0))
|
| | 21 | error(message('MATLAB:xlabel:InvalidNumberOfInputs'))
|
| | 22 | end
|
| | 23 |
|
< 0.001 | 2 | 24 | if isempty(ax)
|
< 0.001 | 2 | 25 | ax = gca;
|
| | 26 |
|
| | 27 | % Chart subclass support
|
| | 28 | % Invoke xlabel method with same number of outputs to defer output arg
|
| | 29 | % error handling to the method.
|
< 0.001 | 2 | 30 | if isa(ax,'matlab.graphics.chart.Chart')
|
| | 31 | if(nargout == 1)
|
| | 32 | hh = xlabel(ax,args{:});
|
| | 33 | else
|
| | 34 | xlabel(ax,args{:});
|
| | 35 | end
|
| | 36 | return
|
| | 37 | end
|
< 0.001 | 2 | 38 | end
|
| | 39 |
|
< 0.001 | 2 | 40 | string = args{1};
|
< 0.001 | 2 | 41 | if isempty(string), string=''; end
|
< 0.001 | 2 | 42 | pvpairs = args(2:end);
|
| | 43 |
|
| | 44 | % get-set does not support strings as of now
|
< 0.001 | 2 | 45 | pvpairs = matlab.graphics.internal.convertStringToCharArgs(pvpairs);
|
| | 46 |
|
< 0.001 | 2 | 47 | if isappdata(ax,'MWBYPASS_xlabel')
|
| | 48 | h = mwbypass(ax,'MWBYPASS_xlabel',string,pvpairs{:});
|
| | 49 |
|
| | 50 | %---Standard behavior
|
< 0.001 | 2 | 51 | else
|
0.008 | 2 | 52 | h = get(ax,'XLabel');
|
0.001 | 2 | 53 | set(h,'FontSizeMode','auto',...
|
| | 54 | 'FontUnitsMode','auto',...
|
| 2 | 55 | 'FontWeight',get(ax,'FontWeight'),...
|
| 2 | 56 | 'FontAngle',get(ax,'FontAngle'),...
|
| 2 | 57 | 'FontName',get(ax,'FontName'));
|
< 0.001 | 2 | 58 | set(h, 'String', string, pvpairs{:});
|
| | 59 |
|
< 0.001 | 2 | 60 | end
|
| | 61 |
|
< 0.001 | 2 | 62 | if nargout > 0
|
| | 63 | hh = h;
|
| | 64 | end
|
Other subfunctions in this file are not included in this listing.