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-2019 The MathWorks, Inc.
|
| | 15 |
|
< 0.001 | 12 | 16 | if nargout>0
|
| | 17 | [isaxarr,hh]=matlab.graphics.chart.internal.objArrayDispatch(@xlabel,varargin{:});
|
< 0.001 | 12 | 18 | else
|
0.007 | 12 | 19 | isaxarr=matlab.graphics.chart.internal.objArrayDispatch(@xlabel,varargin{:});
|
< 0.001 | 12 | 20 | end
|
< 0.001 | 12 | 21 | if isaxarr
|
| | 22 | return
|
< 0.001 | 12 | 23 | end
|
| | 24 |
|
| | 25 | % if the input has an xlabel property which is a text object, use it to set
|
| | 26 | % the xlabel on.
|
0.003 | 12 | 27 | [ax,args,nargs] = labelcheck('XLabel',varargin);
|
| | 28 |
|
< 0.001 | 12 | 29 | if nargs == 0 || (nargs > 1 && (rem(nargs-1,2) ~= 0))
|
| | 30 | error(message('MATLAB:xlabel:InvalidNumberOfInputs'))
|
< 0.001 | 12 | 31 | end
|
| | 32 |
|
< 0.001 | 12 | 33 | if isempty(ax)
|
< 0.001 | 12 | 34 | ax = gca;
|
| | 35 |
|
| | 36 | % Chart subclass support
|
| | 37 | % Invoke xlabel method with same number of outputs to defer output arg
|
| | 38 | % error handling to the method.
|
< 0.001 | 12 | 39 | if isa(ax,'matlab.graphics.chart.Chart')
|
| | 40 | if(nargout == 1)
|
| | 41 | hh = xlabel(ax,args{:});
|
| | 42 | else
|
| | 43 | xlabel(ax,args{:});
|
| | 44 | end
|
| | 45 | return
|
< 0.001 | 12 | 46 | end
|
< 0.001 | 12 | 47 | end
|
| | 48 |
|
< 0.001 | 12 | 49 | if isa(ax,'matlab.graphics.axis.GeographicAxes')
|
| | 50 | error(message('MATLAB:Chart:UnsupportedConvenienceFunction', 'xlabel', ax.Type));
|
< 0.001 | 12 | 51 | end
|
| | 52 |
|
< 0.001 | 12 | 53 | string = args{1};
|
< 0.001 | 12 | 54 | if isempty(string), string=''; end
|
< 0.001 | 12 | 55 | pvpairs = args(2:end);
|
| | 56 |
|
| | 57 | % get-set does not support strings as of now
|
0.002 | 12 | 58 | pvpairs = matlab.graphics.internal.convertStringToCharArgs(pvpairs);
|
| | 59 |
|
< 0.001 | 12 | 60 | if isappdata(ax,'MWBYPASS_xlabel')
|
| | 61 | h = mwbypass(ax,'MWBYPASS_xlabel',string,pvpairs{:});
|
| | 62 |
|
| | 63 | %---Standard behavior
|
< 0.001 | 12 | 64 | else
|
0.240 | 12 | 65 | h = get(ax,'XLabel');
|
< 0.001 | 12 | 66 | if ~isa(ax,'matlab.graphics.layout.Layout')
|
0.007 | 12 | 67 | set(h,'FontSizeMode','auto',...
|
| | 68 | 'FontUnitsMode','auto',...
|
| 12 | 69 | 'FontWeight',get(ax,'FontWeight'),...
|
| 12 | 70 | 'FontAngle',get(ax,'FontAngle'),...
|
| 12 | 71 | 'FontName',get(ax,'FontName'));
|
< 0.001 | 12 | 72 | end
|
0.003 | 12 | 73 | set(h, 'String', string, pvpairs{:});
|
| | 74 |
|
< 0.001 | 12 | 75 | end
|
| | 76 |
|
< 0.001 | 12 | 77 | if nargout > 0
|
| | 78 | hh = h;
|
< 0.001 | 12 | 79 | end
|
Other subfunctions in this file are not included in this listing.