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