How to plot 3 y axis or more in a single graph?

668 views (last 30 days)
For example: I have to plot X=(1:1:50); Y1=sin(X); Y2=exp(X); Y3=(X).^2; For y-plot I want respective adjusted range of axis.
  2 Comments
Roy Kadesh
Roy Kadesh on 13 Jan 2018
What do you mean? Do you mean you want to plot 3 lines in one figure?
UTKARSH VERMA
UTKARSH VERMA on 13 Jan 2018
Edited: UTKARSH VERMA on 13 Jan 2018
I want 3 line in one graph but with 3 axis representing their respective line. For example for Y1 yaxis value range should of range between -1 to 1 but if i use exp(i.e. Y2) axis to represent Y1 then it may give straight line.

Sign in to comment.

Accepted Answer

ANKUR KUMAR
ANKUR KUMAR on 14 Jan 2018
Edited: ANKUR KUMAR on 14 Jan 2018
plot((1:5),randi(25,1,5),'r')
addaxis((1:5),randi(25,1,5),'g')
addaxis((1:5),randi(25,1,5),'m')
addaxis((1:5),randi(25,1,5),'y')
legend({'plot1','plot2','plot3','plot4'})
  10 Comments
Alessandro De Iasio
Alessandro De Iasio on 23 Sep 2022
Was anyone able to plot more than one curve for the nth axis?

Sign in to comment.

More Answers (2)

Jan
Jan on 13 Jan 2018
Edited: Jan on 13 Jan 2018
  4 Comments
UTKARSH VERMA
UTKARSH VERMA on 14 Jan 2018
Yes, I want to know how to use that function.
Jan
Jan on 14 Jan 2018
Edited: Jan on 14 Jan 2018
Simply download it and call it. The help section of this function explains the details. Or see the suggestion of ANKUR KUMAR.

Sign in to comment.


yeswanth reddy
yeswanth reddy on 29 Sep 2021
plot((1:5),randi(25,1,5),'r')
addaxis((1:5),randi(25,1,5),'g')
addaxis((1:5),randi(25,1,5),'m')
addaxis((1:5),randi(25,1,5),'y')
legend({'plot1','plot2','plot3','plot4'})

Categories

Find more on Two y-axis in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!