Problem using the subplot command
이전 댓글 표시
Hello, I want to plot 3 graphs in a single figure. I want to use the subplot command. However, I am unable to plot the graph vertically.
eg:
x = 0:5;
y = sin(x);
z = log(y);
subplot(2,2,1:3), plot(x,y)
subplot(2,2,2), plot(y,z)
subplot(2,2,4), plot(x,z)
This code does not work properly.
However, if I try to plot the graph horizontally, it works very well
eg:
x = 0:5;
y = sin(x);
z = log(y);
subplot(2,2,1:2), plot(x,y)
subplot(2,2,3), plot(y,z)
subplot(2,2,4), plot(x,z)
why is this so ? How can I plot vertically ?
Harshal
채택된 답변
추가 답변 (1개)
Abioye Samson
2012년 8월 17일
0 개 추천
you can write it this way Subplot(m,,n,p)
so far you want to plot 3 figure vertically on the same figure that means m which is the row=1 n which is the column=3 while p is going to be=1,2,or 3.
code codes below
subplot(1,3,1)% first graph left
plot(x,y)
subplot(1,3,2)% second graph middle
plot(y,z)
subplot(1,3,3)%third graph right
plot(x,z)
카테고리
도움말 센터 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!