Mercurial > hg > ishara
changeset 60:547c48f3a008
multibar Now takes base plotting function
author | samer |
---|---|
date | Sat, 10 Oct 2015 15:20:18 +0100 |
parents | d060797e9b62 |
children | eff6bddf82e3 |
files | graphics/multibar.m |
diffstat | 1 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graphics/multibar.m Fri Oct 09 15:57:39 2015 +0100 +++ b/graphics/multibar.m Sat Oct 10 15:20:18 2015 +0100 @@ -1,9 +1,11 @@ % multibar - Multiple bar plots with different domains. % -% multibar :: cells(pair([[N]->Dom],[[N]])), options -> handle. -function h=multibar(D,varargin) +% multibar :: plotfn, cells(pair([[N]->Dom],[[N]])), options -> handle. +% plotfn is any plotting function like bar, plot, area stairs etc +% that takes two arrays of X and Y values. +function h=multibar(F,D,varargin) X=flatten(foldl(@union,[],map(@fst,D))); - h=bar(X,cellcat(2,map(@(d)expand(X,d),D)),varargin{:}); + h=F(X,cellcat(2,map(@(d)expand(X,d),D)),varargin{:}); end function Y2=expand(X,Data)