Comparing timeseries with linkaxes but axes won't link anymore.

1 回表示 (過去 30 日間)
Heidi Hirsh
Heidi Hirsh 2019 年 5 月 24 日
I have several timeseries that I am trying to compare. I want be able to zoom in to periods of 2-3 days at a time to step through the data and compare trends in different parameters. I was using linkaxes to do this and for a while it was working. For some reason it is no longer working! Any ideas where I might be messing it up? I copied some code below and I am attaching a screen shot of the (disgusting) full timeseries...
%% Stack all timeseries for mooring
start = 'Aug-10-2018'
stop = 'Oct-5-2018'
plotnum=9
f2=figure(2)
%____________PH________________
ax(1)= subplot(plotnum,1,1)
n = size(pHint,1);
colors = flipud(jet(n)); %flip color scheme
h = plot(X,pHint);
set(h, {'color'}, num2cell(colors, 2));
legend('SP2 6.12 mab','MF4 5.18 mab','MF7 4.52 mab','MF3 3.56 mab','MF2 2.58 mab','MF5 1.45 mab','SP1 1.06 mab','location','best');
ylabel('pH');
title('PK Mooring')
x = datenum(start):7:datenum(stop);
xx = datenum(start):1:datenum(stop);
set(gca,'XTick', x);
ax=gca;
ax.XAxis.MinorTick = 'on'
ax.XAxis.MinorTickValues = xx
datetick('x','mm/dd','keepticks')
%xlim([datenum('July-18-2018 9:00') datenum('July-20-2018 00:00')]);
%___________OXYGEN________________
ax(2)=subplot(plotnum,1,2)
plot(pk100m_time,do_pk100m,'Color',[0 .4 .4]);
hold on
plot(pk5_time,do_pk5,'Color',[0 .8 0]);
plot(pk3_time,do_pk3,'Color',[.6 .6 1]);
plot(pk1_time,do_pk1,'Color',[.4 0 .6]);
ylabel('DO (\mumol/kg)')
% ylim([2.5 14.75])
% set(gca,'fontsize',16);
legend('Kelp Surface','PK 5 mab','PK 3 mab','PK 1 mab','location','best')
x = datenum(start):7:datenum(stop);
xx = datenum(start):1:datenum(stop);
set(gca,'XTick', x);
ax=gca;
ax.XAxis.MinorTick = 'on'
ax.XAxis.MinorTickValues = xx
datetick('x','mm/dd','keepticks')
%__________TEMPERATURE______________
ax(3)=subplot(plotnum,1,3)
n = size(TC,1);
colors = flipud(jet(n)); %flip color scheme
h = plot(X,TC);
set(h, {'color'}, num2cell(colors, 2));
legend('SP2 6.12 mab','MF4 5.18 mab','MF7 4.52 mab','MF3 3.56 mab','MF2 2.58 mab','MF5 1.45 mab','SP1 1.06 mab','location','best');
ylabel('Temperature');
x = datenum(start):7:datenum(stop);
xx = datenum(start):1:datenum(stop);
set(gca,'XTick', x);
ax=gca;
ax.XAxis.MinorTick = 'on'
ax.XAxis.MinorTickValues = xx
datetick('x','mm/dd','keepticks')
%_________Depth (pressure)________________
ax(4)=subplot(plotnum,1,4)
plot(ADCPtime, PK_depth)
ylabel('Depth (m)')
ylim([7.5 11])
x = datenum(start):7:datenum(stop);
set(gca, 'XTick', x);
datetick('x','mm/dd','keepticks');
%_________Cross-shore current________________
ax(5)=subplot(plotnum,1,5)
plot(ADCPtime, PK_cross)
ylabel('Cross (m/s)')
x = datenum(start):7:datenum(stop);
xx = datenum(start):1:datenum(stop);
set(gca,'XTick', x);
ax=gca;
ax.XAxis.MinorTick = 'on'
ax.XAxis.MinorTickValues = xx
datetick('x','mm/dd','keepticks')
%_________Alongshore current________________
ax(6)=subplot(plotnum,1,6)
plot(ADCPtime, PK_along)
ylabel('Along (m/s)')
x = datenum(start):7:datenum(stop);
xx = datenum(start):1:datenum(stop);
set(gca,'XTick', x);
ax=gca;
ax.XAxis.MinorTick = 'on'
ax.XAxis.MinorTickValues = xx
datetick('x','mm/dd','keepticks');
%_________BEUTI__________________
ax(7)=subplot(plotnum,1,7)
plot(btimestamp,Bmean3637,'.')
ylabel('BEUTI')
x = datenum(start):7:datenum(stop);
xx = datenum(start):1:datenum(stop);
set(gca,'XTick', x);
ax=gca;
ax.XAxis.MinorTick = 'on'
ax.XAxis.MinorTickValues = xx
datetick('x','mm/dd','keepticks')
%__________Fluorescence_____________
ax(8)=subplot(plotnum,1,8)
plot(ftime,fluo,'Color',[0 .8 .8]);
ylabel('Fluorescence');
% set(gca,'fontsize',16);
x = datenum(start):7:datenum(stop);
xx = datenum(start):1:datenum(stop);
set(gca,'XTick', x);
ax=gca;
ax.XAxis.MinorTick = 'on'
ax.XAxis.MinorTickValues = xx
datetick('x','mm/dd','keepticks')
%_________Wind__________________
ax(9)=subplot(plotnum,1,9)
%Plot 2 principal components
plot(wtime,pE,'k')
hold on
plot(wtime,pN,'b')
h=legend(['Dir = ',num2str(90-theta,3),'^{\circ}'],['Dir = ',num2str(-theta,2),'^{\circ}'],...
'Location','best')
ylim([-6 8])
ylabel('Wind speed (m/s)')
x = datenum(start):7:datenum(stop);
xx = datenum(start):1:datenum(stop);
set(gca,'XTick', x);
ax=gca;
ax.XAxis.MinorTick = 'on'
ax.XAxis.MinorTickValues = xx
datetick('x','mm/dd','keepticks')
linkaxes(ax,'x')

回答 (0 件)

カテゴリ

Help Center および File ExchangeDebugging and Analysis についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by