samer@0: % plotter - Arrow for doing plots. samer@0: % samer@0: % plotter :: options { samer@0: % dom :: [[N]->nonneg] / (1:N) ~'X values for plots'; samer@0: % ylim :: [[_]->nonneg] / [] ~'passed to ylim if not empty'; samer@0: % xlim :: [[_]->nonneg] / [] ~'passed to xlim if not empty'; samer@0: % xlabel :: [[_]->nonneg] / [] ~'passed to xlabel if not empty'; samer@0: % ylabel :: [[_]->nonneg] / [] ~'passed to ylabel if not empty'; samer@0: % plotfn :: plotfn / @plot ~'function to create image'; samer@0: % args :: {[_]} / {} ~'extra arguments for plotfn' samer@0: % } -> arrow({[[N,M]]}, {}, empty) ~'arrow from 2D arrays'. samer@0: % samer@0: % plotter is an arrow which displays each input array as line plots samer@0: % using plot by default. The essential thing about plotter is that samer@0: % the graphics must be updated by setting the 'YData' property of samer@0: % the handle graphics object returned by the plotting function. samer@0: samer@0: function o=plotter(varargin) samer@37: s.opts=options('dlim',[],'dom',[],'ylim',[],'xlim',[],'plotfn',@plot,'args',{},'transpose',0,varargin{:}); samer@0: if isempty(s.opts.ylim), s.opts.ylim=s.opts.dlim; end samer@0: o=class(s,'plotter',agraph(1,s.opts)); samer@0: end samer@0: