Help with multiple plot at same figure

Hello, I've got a problem. I don't know how can I do a multiple plot at same figure, this is my code,that I wanna merge
for j = 1:Ne
jj = jj+1; if jj > Ne, jj = 1; end
plot(up(:,j),zp, scm(jj,:),'LineWidth',2,'MarkerSize',3); hold on
st(j,:) = sprintf('%5.1f ut',t(j));
end
for j=1:nl
plot(zp,lp(1,j),'k*','LineWidth',3,'MarkerSize',2); hold on
end

 채택된 답변

Robert Cumming
Robert Cumming 2011년 5월 5일

0 개 추천

hold on

댓글 수: 4

Marco Esteves
Marco Esteves 2011년 5월 5일
I've got two "hold on".
The first hold on to hold the lines from the first plot instruction and the second hold to hold the line from the second plot instruction.
With this code, the second "for cycle" doesn't appear on figure.
Paulo Silva
Paulo Silva 2011년 5월 5일
Please don't accept an answer that's not what you are looking for!
Your way to use the hold on isn't optimal, first create the axes object with the axes function if you don't have one already, now just do hold on once before your for loop.
I don't know exactly what you are looking for when you say "Help with multiple plot at same figure", do you want to plot everything in the same axes or in two different axes in the same figure?
See the subplot function if you want two axes (one for each loop).
Robert Cumming
Robert Cumming 2011년 5월 5일
that'll teach me for not reading the question fully...
I agree that the actual problem is not that clear
Paulo Silva
Paulo Silva 2011년 5월 5일
The questions are almost never that simple :) and many times the OP will change his/her mind and ask something very different from the first question.

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

추가 답변 (1개)

Marco Esteves
Marco Esteves 2011년 5월 6일

0 개 추천

I've got 2 cyles to get plot curves. I need to override the result of plots in the same figure
for j = 1:Ne
jj = jj+1; if jj > Ne, jj = 1; end
plot(up(:,j),zp, scm(jj,:),'LineWidth',2,'MarkerSize',3); hold on
st(j,:) = sprintf('%5.1f ut',t(j));
end
for j=1:nl
plot(zp,lp(1,j),'k*','LineWidth',3,'MarkerSize',2); hold on
end

댓글 수: 1

Robert Cumming
Robert Cumming 2011년 5월 9일
to be honesdt thats still not really clear what your trying to do.
Anyway - try cla to clear the axis or hold off (then on agian after the 1st plot command).

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

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by