The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

Posts: 9,850
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.

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;

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;
% Now add another...
ax2 = axes('Position',pos_ax2,...

Salt to suit...


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.