Plot at the same figure
이전 댓글 표시
Hi,
I have two m scripts with the same code for plotting. How can I plot results from the two scripts at the same plot?
figure1 = figure('Color',[0 1 1]);
axes1 = axes('Parent',figure1,'FontSize',12,'FontName','arial');
plot1 = plot(X,Y,'Parent',axes1,'MarkerSize',3);
hold all;
set(plot1(1),'MarkerFaceColor',[1 0 1],'Color',[1 0 1]);
Thank you
채택된 답변
추가 답변 (1개)
Mischa Kim
2014년 6월 27일
Anya, how about adding a
hold all
after the first plot command?
댓글 수: 6
Anya
2014년 6월 27일
Mischa Kim
2014년 6월 27일
OK. Could you post all the code for the four command lines you posted? Debugging is a challenge without.
Anya
2014년 6월 27일
Mischa Kim
2014년 6월 27일
편집: Mischa Kim
2014년 6월 27일
This should do:
% first script
X = 1:10;
Y = sin(X);
figure1 = figure('Color',[0 1 1]);
axes1 = axes('Parent',figure1,'FontSize',12,'FontName','arial');
plot1 = plot(X,Y,'Parent',axes1,'MarkerSize',3);
set(plot1(1),'MarkerFaceColor',[1 0 1],'Color',[1 0 1]);
hold all;
...
% second script
X = 1:10;
Y = cos(X);
plot1 = plot(X,Y,'MarkerSize',3);
set(plot1(1),'MarkerFaceColor',[1 0 1],'Color',[1 0 1]);
...
You probably want to change the settings in the second set command, though.
Anya
2014년 6월 27일
Anya
2014년 6월 27일
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!