Plot at the same figure

1 次查看(过去 30 天)
Anya
Anya 2014-6-27
评论: Anya 2014-6-27
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

采纳的回答

lvn
lvn 2014-6-27
编辑:lvn 2014-6-27
The problem are these lines:
figure1 = figure('Color',[0 1 1]);
axes1 = axes('Parent',figure1,'FontSize',12,'FontName','arial');
which creates a new figure. Simply remove it in the last 2 m-files and it should work.
  1 个评论
Anya
Anya 2014-6-27
I tried with figure('Color',[0 1 1]); in last 2 m-files but still the same , I have different figures, code:
figure('Color',[0 1 1]);
axes1 = axes('Parent',figure,'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]);

请先登录,再进行评论。

更多回答(1 个)

Mischa Kim
Mischa Kim 2014-6-27
Anya, how about adding a
hold all
after the first plot command?
  6 个评论
Anya
Anya 2014-6-27
This is working but you deleted axis and figure definition which I want to use in the second script
Anya
Anya 2014-6-27
I put parametars that I needed from the figure and axis into plot and got the same. Thank you it is working now

请先登录,再进行评论。

类别

Help CenterFile 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!

Translated by