%%%% ogram will take any trace data and plot a 24 hour time series for the %%%% data %%%% input data must be in decimal days and then y values %function ogram(ts,trace,scale) %ts is the time series in decimal days %trace is the data trace %scale is the vertical scaling, bigger numbers mean higher gain %scale_bar is the units of amplitude for the scale bar function ogram(ts,trace,scale,name,scale_bar) trace(isnan(ts)) = []; ts(isnan(ts)) = []; decimation = round((1/5/60/60/24)/(ts(2)-ts(1))) decimation = round((1/50/60/60/24)/(ts(2)-ts(1))) ts=ts(1:decimation:length(ts)); trace=trace(1:decimation:length(trace)); trace=double(trace); if size(trace,2)==1; trace=trace'; end if nargin<3; scale=2; end if nargin>2 & isempty(scale); scale = 2; end if nargin<4; name=''; end if nargin==5; end %%% plot one hour per line %%% first convert time series to decimal hours tracerange=max(trace)-min(trace); if nargin>2 & length(scale)>1 tracerange = max(scale) - min(scale); scale = 1; end trace=trace/tracerange; firstday=floor(ts(1)); lastday=floor(ts(length(ts))); %keyboard if (lastday-firstday)>30; disp(['error: too many plots!']); return; end for i=firstday:lastday % range of days %figure(i+1-firstday) if (max(ts)-min(ts))>1; figure; end trace_plot=trace(ts>=i & ts =i & ts 1; print('-djpeg90',tit); end end if nargin==5; % insert scale bar hold on h = plot(max(xlim)+[0 0],min(ts)*24+[-.5 .5],'w'); set(h,'linewidth',8) h = plot(max(xlim)-.01*diff(xlim)+[0 0],min(ts)*24+[-.5 .5],'k'); set(h,'linewidth',2) t = text(max(xlim)-.01*diff(xlim),min(ts)*24-.5,[num2str(significant_digits(tracerange/scale,2)) ' ' scale_bar ' ']); set(t,'horizontalalignment','right') %set(t,'verticalalignment','bottom') set(t,'fontsize',8) end end % add scale bar