How to plot three y-axes in one figure, where each one y-axis have three lines to be plotted?

3 views (last 30 days)
How to plot 3 y-axes in one figure, where each one y-axis have 3 lines to be plotted? Something like Fig below for which I have used the addaxis function, however, I can only plot one line for the 3rd y-axis. May I know how to plot 3 lines for 3rd y-axis?
x=1:5;
y11=[2 3 4 5 6];
y12=[2 3 2 1 3];
y13=[2 3 4 5 2];
y21=[2 1 1 1 3];
y22=[1 2 1 2 3];
y23=[4 5 2 1 2];
y31=[3 3 2 4 5];
y32=[2 1 14 5 6];
y33=[11 3 4 5 2];
figure;
plot(x,y11,y12,y13);%1st y-axis
plot(x,y21,y22,y23);%2nd y-axis
plot(x,y31,y32,y33);%3rd y-axis

Answers (1)

sloppydisk
sloppydisk on 31 May 2018
Check out
doc subplot
For your example:
figure(1);
subplot(3, 1, 1)
plot(x,y11,y12,y13);%1st y-axis
subplot(3, 1, 2)
plot(x,y21,y22,y23);%2nd y-axis
subplot(3, 1, 3)
plot(x,y31,y32,y33);%3rd y-axis
I assume this is what you're talking about?
  1 Comment
Chaoyang Jiang
Chaoyang Jiang on 31 May 2018
Thank you for your answer, I mean at the same figure, not in the form of subplot. I have attached the expecting figure in the question.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!