seabreeze
Marine/Ocean
- Oct 17, 2002
- 5
Hello out there,
I am trying to plot two curves in one figure - one scaled on the left y-axes, the 2nd on the right y-axes. I found something about it in the help-desk - but for some reason it does not work. The "YAxisLocation" semes to be ignored...
Belwo I print the part from my script. I appreciate any helpful comment on it! Thanks!
hl1 = plot(x,y1,'k-','LineWidth',1.5);
ax1 = gca;
set(ax1,'TickDir','out','YTick',[0 1 2 3 4 5 6 7],'YTickLabel',[' 0';' ';' 2';' ';' 4';' ';' 6';' '],'XTick',[0 3 6 9 12 15 18 21 24],'XTickLabel',[' ';' ';' ';' ';' ';' ';' ';' ';' '],'FontSize',11,'FontName','Arial','FontWeight','bold');
axis([0 24 0 7]);grid on;
title('Januar','FontSize',12,'FontName','Arial','FontWeight','bold');
ylabel('T_{a} (^{\circ}C)','FontSize',11,'FontName','Arial','FontWeight','bold');
ax2 = axes('Position',get(ax1,'Position'),'YAxisLocation','right');
plot(x,z1,'k--','LineWidth',1.5,'Parent',ax2); %,'Parent',ax2
ylabel('\Delta T_{a} (K)','FontSize',11,'FontName','Arial','FontWeight','bold');
set(ax2,'TickDir','out','YTick',[-0.4 -0.2 0 0.2 0.4 0.6 0.8 1],'YTickLabel',['-0.4';' ';' 0 ';' ';' 0.4';' ';' 0.8';' '],'XTick',[0 3 6 9 12 15 18 21 24],'XTickLabel',[' ';' ';' ';' ';' ';' ';' ';' ';' '],'FontSize',11,'FontName','Arial','FontWeight','bold');
axis([0 24 -0.4 1]);
I am trying to plot two curves in one figure - one scaled on the left y-axes, the 2nd on the right y-axes. I found something about it in the help-desk - but for some reason it does not work. The "YAxisLocation" semes to be ignored...
Belwo I print the part from my script. I appreciate any helpful comment on it! Thanks!
hl1 = plot(x,y1,'k-','LineWidth',1.5);
ax1 = gca;
set(ax1,'TickDir','out','YTick',[0 1 2 3 4 5 6 7],'YTickLabel',[' 0';' ';' 2';' ';' 4';' ';' 6';' '],'XTick',[0 3 6 9 12 15 18 21 24],'XTickLabel',[' ';' ';' ';' ';' ';' ';' ';' ';' '],'FontSize',11,'FontName','Arial','FontWeight','bold');
axis([0 24 0 7]);grid on;
title('Januar','FontSize',12,'FontName','Arial','FontWeight','bold');
ylabel('T_{a} (^{\circ}C)','FontSize',11,'FontName','Arial','FontWeight','bold');
ax2 = axes('Position',get(ax1,'Position'),'YAxisLocation','right');
plot(x,z1,'k--','LineWidth',1.5,'Parent',ax2); %,'Parent',ax2
ylabel('\Delta T_{a} (K)','FontSize',11,'FontName','Arial','FontWeight','bold');
set(ax2,'TickDir','out','YTick',[-0.4 -0.2 0 0.2 0.4 0.6 0.8 1],'YTickLabel',['-0.4';' ';' 0 ';' ';' 0.4';' ';' 0.8';' '],'XTick',[0 3 6 9 12 15 18 21 24],'XTickLabel',[' ';' ';' ';' ';' ';' ';' ';' ';' '],'FontSize',11,'FontName','Arial','FontWeight','bold');
axis([0 24 -0.4 1]);