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

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 comentarios

Roy Kadesh
Roy Kadesh el 13 de En. de 2018
What do you mean? Do you mean you want to plot 3 lines in one figure?
UTKARSH VERMA
UTKARSH VERMA el 13 de En. de 2018
Editada: UTKARSH VERMA el 13 de En. de 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.

Iniciar sesión para comentar.

 Respuesta aceptada

ANKUR KUMAR
ANKUR KUMAR el 14 de En. de 2018
Editada: ANKUR KUMAR el 14 de En. de 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 comentarios

UTKARSH VERMA
UTKARSH VERMA el 14 de En. de 2018
Editada: UTKARSH VERMA el 14 de En. de 2018
It's working, thank you.
SRIKESHAV VENKATARAMAN NIKHILESH
SRIKESHAV VENKATARAMAN NIKHILESH el 11 de Mayo de 2018
Editada: SRIKESHAV VENKATARAMAN NIKHILESH el 11 de Mayo de 2018
Hi, I tried to use the above mentioned function from the files exchange. And tried to use it in the way Ankur has coded. However I am getting a few errors -
Error using matlab.graphics.axis.Axes/get
There is no colorord property on the Axes class.
Error in aa_splot (line 13) cord = get(gca,'colorord');
Error in addaxis (line 135) hplts = aa_splot(varargin{:});
I receive the same errors. Is there any way to just add some axes easily without going through 200 code lines and get exhausted?
Malik Tahiyat
Malik Tahiyat el 13 de Feb. de 2019
replace all 'colorord' in aa_splot.m to 'ColorOrder' and it would work.
Franziska Ba
Franziska Ba el 27 de Mzo. de 2019
Editada: Franziska Ba el 27 de Mzo. de 2019
I already have changed the 'colorord' to 'ColorOrder', but I am getting still the following error:
Error in addaxis (line 112) hplt = plot(varargin{:});
andre contini
andre contini el 26 de Mayo de 2020
Editada: andre contini el 26 de Mayo de 2020
I changed 'colorord' in aa_splot.m to 'ColorOrder' and it works well.
tks @Franziska Ba
jasongrig
jasongrig el 18 de Nov. de 2020
how can I select whether the new axis goes to the left or right side of the plot?
Robert Wei
Robert Wei el 15 de Sept. de 2021
This function has a major bug - when you pan around, only one of the axes (primary axis) updates. the others do not
Was anyone able to plot more than one curve for the nth axis?

Iniciar sesión para comentar.

Más respuestas (2)

Jan
Jan el 13 de En. de 2018
Editada: Jan el 13 de En. de 2018

2 votos

4 comentarios

UTKARSH VERMA
UTKARSH VERMA el 14 de En. de 2018
Yes, I mean this https://www.mathworks.com/matlabcentral/fileexchange/46688-jzplotys-zip . Is there any command like plotyy for two y-axes?
Rik
Rik el 14 de En. de 2018
If that submission works for you, why not use it? Or is your question how to use that function?
UTKARSH VERMA
UTKARSH VERMA el 14 de En. de 2018
Yes, I want to know how to use that function.
Jan
Jan el 14 de En. de 2018
Editada: Jan el 14 de En. de 2018
Simply download it and call it. The help section of this function explains the details. Or see the suggestion of ANKUR KUMAR.

Iniciar sesión para comentar.

yeswanth reddy
yeswanth reddy el 29 de Sept. de 2021

0 votos

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'})

Categorías

Etiquetas

Preguntada:

el 13 de En. de 2018

Comentada:

el 23 de Sept. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by