×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

multiple axes with Matlab_SE5.3

multiple axes with Matlab_SE5.3

multiple axes with Matlab_SE5.3

(OP)
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]);

RE: multiple axes with Matlab_SE5.3

Well, beyond the fact I can't make sense of what you are trying to do, and ignoring the fact that Matlab 5.3 is about 5 years out of date, I will offer one point.

Anytime you want to plot more than one plot in a figure window, you must issue the "hold on" command immediately after you issue the "figure" command.  Otherwise, your figure will only contain the last plot.  No matter, what else is wrong.

RE: multiple axes with Matlab_SE5.3

(OP)
thanks for your answer - to give a reason for this figure: I want the temperature of one measuring height scaled on the left axis and the deviation of another measuring height from this one on the other axis. That's a quite common type of figure, isn't it?

I've tried it with the "hold on" but it doesn't help. It still shows both axis labels on the left side and the figure itself contains only one line....

RE: multiple axes with Matlab_SE5.3

(OP)
I've got it...thank you

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources