Plot at the same figure

17 Ansichten (letzte 30 Tage)
Anya
Anya am 27 Jun. 2014
Kommentiert: Anya am 27 Jun. 2014
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

Akzeptierte Antwort

lvn
lvn am 27 Jun. 2014
Bearbeitet: lvn am 27 Jun. 2014
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 Kommentar
Anya
Anya am 27 Jun. 2014
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]);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by