Home > timeplt > gregaxy.m

gregaxy

PURPOSE ^

GREGAXY Labels the current x-axis with Gregorian labels in units of years.

SYNOPSIS ^

function []=gregaxy(jd,yeartic);

DESCRIPTION ^

 GREGAXY Labels the current x-axis with Gregorian labels in units of years.
      GREGAXY(JD,YEARTIC) draws Gregorian time labels on the x-axis in
      intervals of YEARTIC days.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function []=gregaxy(jd,yeartic);
0002 % GREGAXY Labels the current x-axis with Gregorian labels in units of years.
0003 %      GREGAXY(JD,YEARTIC) draws Gregorian time labels on the x-axis in
0004 %      intervals of YEARTIC days.
0005 
0006 % Rich Signell
0007 n=length(jd);
0008 
0009 jd0_index = find(jd == gmin(jd));
0010 jd0=jd(jd0_index(1));
0011 
0012 jdn_index = find(jd == gmax(jd));
0013 n = length(jdn_index);
0014 jd1=jd(jdn_index(n));
0015 
0016 start=gregorian(jd0);
0017 stop=gregorian(jd1);
0018 
0019 start=[start(1) 0 0 0 0 0];
0020 stop=[stop(1)+1 0 0 0 0 0];
0021 jd0=julian(start);
0022 jd1=julian(stop);
0023 %xlim=[jd0-180 jd1+180];
0024 %set(gca,'xlim',xlim);
0025 ylim=get(gca,'ylim');  
0026 %
0027 year=[start(1):yeartic:stop(1)]';
0028 n=length(year);
0029 greg=[year ones(n,2) zeros(n,3)];
0030 jdtic=julian(greg);
0031 
0032 %
0033 % find year labels
0034 %
0035 yearticlab=sprintf('%4.4d',year');
0036 nyear=length(year);
0037 yearticlab=reshape(yearticlab,4,nyear)';
0038 set(gca,'xtick',jdtic,'Xticklabels',yearticlab)
0039 xlabel('Year')
0040 %

Generated on Wed 30-Nov-2005 15:41:21 by m2html © 2003