Hi, I want to plot 4 y-axes against x-axis. How do I plot it?

조회 수: 28 (최근 30일)
Isa Isa
Isa Isa 2017년 3월 2일
답변: Rik 2017년 3월 2일
Hi, I want to plot 4 y-axes against x-axis. I want to put legend and colour. How do I plot it? Thanks Isa
  댓글 수: 2
Jos (10584)
Jos (10584) 2017년 3월 2일
편집: Jos (10584) 2017년 3월 2일
Something like plotyy but then with four y-axes? Can you draw an example?
Isa Isa
Isa Isa 2017년 3월 2일
Like x = linspace(0,5); y1 = sin(x); y2 = sin(5*x); y3= sin(10*x); y4=sin(15*x); Plot y1,y2,y3 and y4 against x

댓글을 달려면 로그인하십시오.

답변 (2개)

Rik
Rik 2017년 3월 2일
Another interpretation of your question results in this solution:
x = linspace(0,2*pi); y1 = sin(x); y2 = sin(5*x); y3= sin(10*x); y4=sin(15*x);
plot(x,y1,'b',x,y2,'r',x,y3,'c',x,y4,'k')
legend({'sine of x','sine of 5x','sine of 10x','sine of 15x'})

Meade
Meade 2017년 3월 2일
Check out the excellent addaxis function by Harry Lee.
It let's you add n y-axes to any plot, plus has lots of extended functionality for redrawing, adding additional lines after plotting, etc, etc.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by