time | calls | line |
---|
| | 1 | function hh = area(varargin)
|
| | 2 | %AREA Filled area plot.
|
| | 3 | % AREA(X,Y) produces a stacked area plot suitable for showing the
|
| | 4 | % contributions of various components to a whole.
|
| | 5 | %
|
| | 6 | % For vector X and Y, AREA(X,Y) is the same as PLOT(X,Y) except that
|
| | 7 | % the area between 0 and Y is filled. When Y is a matrix, AREA(X,Y)
|
| | 8 | % plots the columns of Y as filled areas. For each X, the net
|
| | 9 | % result is the sum of corresponding values from the columns of Y.
|
| | 10 | %
|
| | 11 | % AREA(Y) uses the default value of X=1:SIZE(Y,1).
|
| | 12 | %
|
| | 13 | % AREA(X,Y,LEVEL) or AREA(Y,LEVEL) specifies the base level
|
| | 14 | % for the area plot to be at the value y=LEVEL. The default
|
| | 15 | % value is LEVEL=0.
|
| | 16 | %
|
| | 17 | % AREA(...,'Prop1',VALUE1,'Prop2',VALUE2,...) sets the specified
|
| | 18 | % properties of the underlying areaseries objects.
|
| | 19 | %
|
| | 20 | % AREA(AX,...) plots into axes with handle AX. Use GCA to get the
|
| | 21 | % handle to the current axes or to create one if none exist.
|
| | 22 | %
|
| | 23 | % H = AREA(...) returns a vector of handles to areaseries objects.
|
| | 24 | %
|
| | 25 | % See also PLOT, BAR.
|
| | 26 |
|
| | 27 | % Copyright 1984-2010, 2012 The MathWorks, Inc.
|
| | 28 |
|
| | 29 | % First we check which HG plotting API should be used.
|
| 37 | 30 | if ishg2parent( varargin{:} )
|
0.02 | 37 | 31 | [~, cax, args] = parseplotapi(varargin{:},'-mfilename',mfilename);
|
| 37 | 32 | try
|
0.39 | 37 | 33 | h = areaHGUsingMATLABClasses(cax, args{:});
|
| | 34 | catch me
|
| | 35 | throw(me)
|
| | 36 | end
|
| | 37 | else
|
| | 38 | [v6, args] = usev6plotapi(varargin{:},'-mfilename',mfilename);
|
| | 39 | [cax, args] = axescheck(args{:});
|
| | 40 | if v6
|
| | 41 | h = Lareav6(cax, args{:});
|
| | 42 | else
|
| | 43 | % Parse possible Axes input
|
| | 44 | [args,pvpairs,msg] = parseargs(args);
|
| | 45 | if ~isempty(msg), error(msg); end
|
| | 46 | nargs = length(args);
|
| | 47 |
|
| | 48 | [msg,x,y] = xychk(args{1:nargs},'plot');
|
| | 49 | if ~isempty(msg), error(msg); end
|
| | 50 | hasXData = nargs ~= 1;
|
| | 51 | if min(size(x))==1, x = x(:); end
|
| | 52 | if min(size(y))==1, y = y(:); end
|
| | 53 | n = size(y,2);
|
| | 54 |
|
| | 55 | % handle vectorized data sources and display names
|
| | 56 | extrapairs = cell(n,0);
|
| | 57 | if ~isempty(pvpairs) && (n > 1)
|
| | 58 | [extrapairs, pvpairs] = vectorizepvpairs(pvpairs,n,...
|
| | 59 | {'XDataSource','YDataSource','DisplayName'});
|
| | 60 | end
|
| | 61 |
|
| | 62 | % Create plot
|
| | 63 | if isempty(cax) || ishghandle(cax,'axes')
|
| | 64 | cax = newplot(cax);
|
| | 65 | parax = cax;
|
| | 66 | else
|
| | 67 | parax = cax;
|
| | 68 | cax = ancestor(cax,'axes');
|
| | 69 | end
|
| | 70 |
|
| | 71 | h = [];
|
| | 72 | xdata = {};
|
| | 73 | pkg = findpackage('specgraph');
|
| | 74 | findclass(pkg,'areaseries');
|
| | 75 | listeners = getappdata(0,'SpecgraphAreaListeners');
|
| | 76 | seriesListeners = getappdata(0,'Graph2dSeriesListeners');
|
| | 77 | set(listeners(2),'enable','off');
|
| | 78 | set(seriesListeners(end),'enable','off');
|
| | 79 | err = [];
|
| | 80 | try
|
| | 81 | for k=1:n
|
| | 82 | % extract data from vectorizing over columns
|
| | 83 | if hasXData
|
| | 84 | xdata = {'XData', datachk(x(:,k))};
|
| | 85 | end
|
| | 86 | h = [h specgraph.areaseries('YData',datachk(y(:,k)), ...
|
| | 87 | xdata{:}, pvpairs{:},...
|
| | 88 | extrapairs{k,:}, 'Parent', parax)];
|
| | 89 | end
|
| | 90 | set(h,'AreaPeers',h);
|
| | 91 | if n > 1
|
| | 92 | set(h(2:end),'RefreshMode','auto');
|
| | 93 | end
|
| | 94 | catch err
|
| | 95 | end
|
| | 96 | set(listeners(2),'enable','on');
|
| | 97 | set(seriesListeners(end),'enable','on');
|
| | 98 | if ~isempty(err)
|
| | 99 | rethrow(err);
|
| | 100 | end
|
| | 101 | set(h(1),'RefreshMode','auto');
|
| | 102 |
|
| | 103 | plotdoneevent(cax,h);
|
| | 104 | h = double(h);
|
| | 105 | end
|
| | 106 | end
|
0.01 | 37 | 107 | if nargout>0, hh = h; end
|
| 37 | 108 | end
|
Other subfunctions in this file are not included in this listing.