reverse-shooting

Matlab scripts for reverse shooting
Log | Files | Refs | README

shade.m (710B)


      1 function []=shade(start,finish,colorstr);
      2 
      3 % function []=shade(start,finish,colorstr);
      4 %
      5 %  start and finish are Nx1 vectors of starting and ending years.
      6 %  The function shades between the start and finish pairs using colorstr
      7 
      8 if ~exist('colorstr'); colorstr='y'; end;  % default is yellow
      9 curax=axis;
     10 y=[curax(3) curax(4) curax(4) curax(3)];
     11 hold on;
     12 for i=1:length(start);
     13   x=[start(i) start(i) finish(i) finish(i)];
     14   fill(x,y,colorstr);
     15 end;
     16   
     17 % Now, prevent the shading from covering up the lines in the plot.  
     18 h = findobj(gca,'Type','line');
     19 set(h,'EraseMode','xor');
     20 
     21 h = findobj(gca,'Type','patch');
     22 set(h,'EdgeColor','none');
     23 
     24 % This last one makes the tick marks visible
     25 set(gca, 'Layer', 'top')