time | Calls | line |
---|
| | 1 | function hh = ylabel(varargin)
|
| | 2 | %YLABEL Y-axis label.
|
| | 3 | % YLABEL('text') adds text beside the Y-axis on the current axis.
|
| | 4 | %
|
| | 5 | % YLABEL('text','Property1',PropertyValue1,'Property2',PropertyValue2,...)
|
| | 6 | % sets the values of the specified properties of the ylabel.
|
| | 7 | %
|
| | 8 | % YLABEL(AX,...) adds the ylabel to the specified axes.
|
| | 9 | %
|
| | 10 | % H = YLABEL(...) returns the handle to the text object used as the label.
|
| | 11 | %
|
| | 12 | % See also XLABEL, 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(@ylabel,varargin{:});
|
< 0.001 | 12 | 18 | else
|
0.003 | 12 | 19 | isaxarr=matlab.graphics.chart.internal.objArrayDispatch(@ylabel,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 a ylabel property which is a text object, use it to set
|
| | 26 | % the ylabel on.
|
0.001 | 12 | 27 | [ax,args,nargs] = labelcheck('YLabel',varargin);
|
| | 28 |
|
< 0.001 | 12 | 29 | if nargs == 0 || (nargs > 1 && (rem(nargs-1,2) ~= 0))
|
| | 30 | error(message('MATLAB:ylabel: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 ylabel 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 = ylabel(ax,args{:});
|
| | 42 | else
|
| | 43 | ylabel(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', 'ylabel', 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.001 | 12 | 58 | pvpairs = matlab.graphics.internal.convertStringToCharArgs(pvpairs);
|
| | 59 |
|
< 0.001 | 12 | 60 | if isappdata(ax,'MWBYPASS_ylabel')
|
| | 61 | h = mwbypass(ax,'MWBYPASS_ylabel',string,pvpairs{:});
|
| | 62 |
|
| | 63 | %---Standard behavior
|
< 0.001 | 12 | 64 | else
|
0.216 | 12 | 65 | h = get(ax,'YLabel');
|
< 0.001 | 12 | 66 | if ~isa(ax,'matlab.graphics.layout.Layout')
|
0.008 | 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.