Hi,
I work on oceanographic data to display the speed current and the salinity along the depth. I make a subplot in which each plot correspond to a specific hour of tide. But the problem is the tick location in logarithmic axis which change for each plot (see the plot).
I want the same scale for the salinity axis and in each plot. To make this, i have try to change the data aspect ratio but nothing change. I hope someone will try to help me. Please find my code below:
fig_02 = figure;set(gcf,'color','white','PaperType','A4','paperorientation','landscape');S1 = subplot(2,5,1);% ====== 1st variable ======
L1 = line(AQD.speed(202:219),AQD.pressure(202:219),'LineStyle','none','Marker','.','color',color(4,:));ax1 = gca;set(ax1,'XColor',color(4,:),'YColor','k','Ydir','reverse','YTicklabel',{'0';'';'2';'';'4';'';'6';'';'8'});xlim([0 1.5]); ylim([0 8]);% legend(L1,'Vit. courant','Location','NorthWestOutside');
% ====== 2nd variable ======
ax2 = axes('Position',get(ax1,'Position'),'XAxisLocation','top','YAxisLocation','right','Color','none','XColor','k','YColor','k','Ygrid','on');set(ax2,'XScale','log','XTick',0:5:35,'XTickLabel',{'0','','10','','20','','30',''},'Ydir','reverse','YTicklabel','');xlim([0 0.1]); ylim([0 8]);L2 = line(PF_4(1:9,5),PF_4(1:9,2),'LineStyle','-.','Marker','*','MarkerSize',6,'Color','k','Parent',ax2);% legend(L2,'Salinité','Location','SouthWestOutside');
%..........................................................................
subplot(2,5,2)% ====== 1st variable ======L3 = line(AQD.speed(690:701),AQD.pressure(690:701),'LineStyle','none','Marker','.','color',color(4,:));ax1 = gca;set(ax1,'XColor',color(4,:),'YColor','k','Ydir','reverse','YTicklabel',{'0';'';'2';'';'4';'';'6';'';'8'});xlim([0 1.5]); ylim([0 8]);% ====== 2nd variable ======ax2 = axes('Position',get(ax1,'Position'),'XAxisLocation','top','YAxisLocation','right','Color','none','XColor','k','YColor','k','Ygrid','on');set(ax2,'XScale','log','XTick',0:5:35,'XTickLabel',{'0','','10','','20','','30',''},'Ydir','reverse','YTicklabel','');xlim([0 0.1]); ylim([0 8]);L4 = line(PF_7(1:9,5),PF_7(1:9,2),'LineStyle','-.','Marker','*','MarkerSize',6,'Color','k','Parent',ax2);%..........................................................................subplot(2,5,3)% ====== 1st variable ======L5 = line(AQD.speed(1749:1772),AQD.pressure(1749:1772),'LineStyle','none','Marker','.','color',color(4,:));ax1 = gca;set(ax1,'XColor',color(4,:),'YColor','k','Ydir','reverse','YTicklabel',{'0';'';'2';'';'4';'';'6';'';'8'});xlim([0 1.5]); ylim([0 8]);% ====== 2nd variable ======ax2 = axes('Position',get(ax1,'Position'),'XAxisLocation','top','YAxisLocation','right','Color','none','XColor','k','YColor','k','Ygrid','on');set(ax2,'XScale','log','XTick',0:5:35,'XTickLabel',{'0','','10','','20','','30',''},'Ydir','reverse','YTicklabel','');xlim([0 0.1]); ylim([0 8]);L6 = line(PF_13(1:9,5),PF_13(1:9,2),'LineStyle','-.','Marker','*','MarkerSize',6,'Color','k','Parent',ax2);%..........................................................................subplot(2,5,4)% ====== 1st variable ======L7 = line(AQD.speed(2895:2919),AQD.pressure(2895:2919),'LineStyle','none','Marker','.','color',color(4,:));ax1 = gca;set(ax1,'XColor',color(4,:),'YColor','k','Ydir','reverse','YTicklabel',{'0';'';'2';'';'4';'';'6';'';'8'});xlim([0 1.5]); ylim([0 8]);% ====== 2nd variable ======ax2 = axes('Position',get(ax1,'Position'),'XAxisLocation','top','YAxisLocation','right','Color','none','XColor','k','YColor','k','Ygrid','on');set(ax2,'XScale','log','XTick',0:5:35,'XTickLabel',{'0','','10','','20','','30',''},'Ydir','reverse','YTicklabel','');xlim([0 0.1]); ylim([0 8]);L8 = line(PF_19(1:9,5),PF_19(1:9,2),'LineStyle','-.','Marker','*','MarkerSize',6,'Color','k','Parent',ax2);%..........................................................................subplot(2,5,5)% ====== 1st variable ======L9 = line(AQD.speed(3750:3768),AQD.pressure(3750:3768),'LineStyle','none','Marker','.','color',color(4,:));ax1 = gca;set(ax1,'XColor',color(4,:),'YColor','k','Ydir','reverse','YTicklabel',{'0';'';'2';'';'4';'';'6';'';'8'});xlim([0 1.5]); ylim([0 8]);% ====== 2nd variable ======ax2 = axes('Position',get(ax1,'Position'),'XAxisLocation','top','YAxisLocation','right','Color','none','XColor','k','YColor','k','Ygrid','on');set(ax2,'XScale','log','XTick',0:5:35,'XTickLabel',{'0','','10','','20','','30',''},'Ydir','reverse','YTicklabel','');xlim([0 0.1]); ylim([0 8]);L10 = line(PF_25(1:9,5),PF_25(1:9,2),'LineStyle','-.','Marker','*','MarkerSize',6,'Color','k','Parent',ax2);
Best regards,
Sylvain
Best Answer