function [stats]=f_Ttrends(fn, T, N, myrs, ND, SF, AF, ttxt) %* plot temperature data and trends % % fn figure number % T temperature record to plot % N column number to plot % myrs [2 x 1] containing start and end years for average % ND no data value % SF flag, write stats on figure or not, 0 for no, 1 for yes % AF flag to plot anomaly only, 0 for no, 1 for yes % ttxt title text, a string of characters % % T each temperature record contains 18 columns, temps in deg C % (:,1) year % (:,2:13) monthly means, Jan, Feb, etc. % (:,14) D-J-F mean % (:,15) M-A-M mean % (:,16) J-J-A mean % (:,17) S-O-N mean % (:,18) annual mean %* define colors and line types to draw switch N case 14 ls=['.b-'; 'b--']; case 15 ls=['.g-'; 'g--']; case 16 ls=['.r-'; 'r--']; case 17 ls=['.c-'; 'c--']; case 18 ls=['.m-'; 'm--']; otherwise ls=['.k-'; 'k--']; end %* use function to compute anomaly and trend [anom, fep, stats]=f_Tanom(T(:,1), T(:,N), myrs); figure(fn) if ~AF subplot(2,1,1) gds=find(T(:,N)~=ND); % find missing data locations plot(T(gds,1), T(gds,N), ls(1,:)) hold on ylabel('(C)') end title(ttxt) if ~AF subplot(2,1,2) end plot(T(:,1), anom, ls(1,:)) hold on plot(fep(:,1), fep(:,2), ls(2,:)) ylabel('anomaly (C)') xlabel('year') if SF text(max(T(:,1))-10, min(anom)/1.5, num2str(stats(1))) text(max(T(:,1))-10, min(anom)/1.1, num2str(stats(2))) end