vertlines

PURPOSE ^

VERTLINES: put vertical lines at time markers

SYNOPSIS ^

function hh=vertlines( xpts, opts );

DESCRIPTION ^

 VERTLINES: put vertical lines at time markers
   vertlines( time_pts )
   vertlines( time_pts, opts ) % line opts i.e. {'LineWidth',2}

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function hh=vertlines( xpts, opts );
0002 % VERTLINES: put vertical lines at time markers
0003 %   vertlines( time_pts )
0004 %   vertlines( time_pts, opts ) % line opts i.e. {'LineWidth',2}
0005 
0006 % $Id: vertlines.m 7089 2024-12-20 20:24:40Z aadler $ (C) A.Adler 2024. Copyright GPL v2 or v3
0007 
0008   if nargin==1; opts = {}; end
0009   if ischar(xpts) && strcmp(xpts,'UNIT_TEST'); do_unit_test; return; end
0010 
0011   xpts = reshape(xpts,1,[]);
0012   oo   = 1+0*xpts;
0013   yl=ylim;
0014   % -negative z to put at back
0015   hh=line([1;1]*xpts,yl'*oo,-[1;1]*oo,'Color',[0,0,0], ...
0016       'HandleVisibility','off',opts{:});
0017   ylim(yl);
0018 
0019 
0020 function do_unit_test
0021   t=linspace(0,100,1000);
0022   plot(t,sin(t).*exp(-t/100));
0023   vertlines([0:20:60]);
0024   vertlines([50],{'LineWidth',3,'Color',[0,1,0]});

Generated on Sun 29-Dec-2024 11:41:59 by m2html © 2005