Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: 3 Y axes wih 4 variable
Replies: 9   Last Post: Apr 24, 2013 9:28 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,290
Registered: 6/7/07
Re: 3 Y axes wih 4 variable
Posted: Apr 20, 2013 10:06 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 4/20/2013 2:24 AM, Murat wrote:
> Hi. I am new in Matlab and i have a problem having plotting 3 'Y' axes
> with one of the Y axes are common with two variable. it's like 4
> variable as in the image. How can i get the true code? Please help me out.
> http://img401.imageshack.us/img401/1750/3yaxeswith2common.png


See doc under 'Graphics -- Objects -- Axes Properties' there's a topic
titled "Using Multiple X= and Y-Axes"

From its example modified slightly...

x1 = [0:.1:40];
y1 = 4.*cos(x1)./(x1+2);
x2 = [1:.2:20];
y2 = x2.^2./x2.^3;

>> hl1 = line(x1,y1,'Color','r');
ax1 = gca;
set(ax1,'XColor','r','YColor','r')

pos_ax1 = get(ax1,'Position'); % get the position vector 1st axis
% set the left position for another; make width so right sides match...
pos_ax2=pos_ax1; pos_ax2(1)=0.25;
pos_ax2(3)=pos_ax1(3)+pos_ax1(1)-pos_ax2(1);
% Now add another...
ax2 = axes('Position',pos_ax2,...
'XAxisLocation','bottom',...
'YAxisLocation','left',...
'Color','none',...
'XColor','k','YColor','k');


Salt to suit...

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.