view arrows/@plotter/plotter.m @ 3:3f77126f7b5f

First major revision of sequence library, now using classdef form, STILL A BIT BROKEN!
author samer
date Wed, 09 Jan 2013 22:22:21 +0000
parents 672052bd81f8
children beb8a3f4a345
line wrap: on
line source
% plotter - Arrow for doing plots.
%
% plotter :: options {
%    dom     :: [[N]->nonneg] / (1:N) ~'X values for plots';
%    ylim    :: [[_]->nonneg] / [] ~'passed to ylim if not empty';
%    xlim    :: [[_]->nonneg] / [] ~'passed to xlim if not empty';
%    xlabel  :: [[_]->nonneg] / [] ~'passed to xlabel if not empty';
%    ylabel  :: [[_]->nonneg] / [] ~'passed to ylabel if not empty';
%    plotfn  :: plotfn / @plot     ~'function to create image';
%    args    :: {[_]}  / {}        ~'extra arguments for plotfn'
% } -> arrow({[[N,M]]}, {}, empty) ~'arrow from 2D arrays'.
%
% plotter is an arrow which displays each input array as line plots
% using plot by default. The essential thing about plotter is that
% the graphics must be updated by setting the 'YData' property of
% the handle graphics object returned by the plotting function.

function o=plotter(varargin)
	s.opts=prefs('dlim',[],'dom',[],'ylim',[],'xlim',[],'plotfn',@plot,'args',{},'transpose',0,varargin{:});
	if isempty(s.opts.ylim), s.opts.ylim=s.opts.dlim; end
	o=class(s,'plotter',agraph(1,s.opts));
end