How to combine two plots into one with separate markers

57 Ansichten (letzte 30 Tage)
Vaultec
Vaultec am 23 Jul. 2014
Kommentiert: mohammed am 15 Aug. 2022
Currently I have two figures
Is there a function that will allow me to combine the two figures into one, though with different marker options. For example combined plot labeled FA would have the data from table1.fig in "o" and the data from table 2.fig in 'x`
Later I think I would have say N number of figures. Is there a way to combine these N number of figures such that each figure would have a different marker using a script?
Thanks in advance

Akzeptierte Antwort

Mischa Kim
Mischa Kim am 23 Jul. 2014
Bearbeitet: Mischa Kim am 23 Jul. 2014
Jimmy, as a very efficient approach (if you only need to do it once) I recommend a simple copy-paste:
  1. Open both figures
  2. Select "Show Plot Tools and Dock Figure" in both figures (see figure below)
  3. Select one of the plot lines and copy [CTRL+C]
  4. Paste [CTRL+V] in the other plot
  5. Change the line properties to your liking
Of course, you could use the programmatic approach, e.g., say you have to figures, one line plot each:
fh1 = open('f1.fig');
fh2 = open('f2.fig');
ax1 = get(fh1, 'Children');
ax2 = get(fh2, 'Children');
ax2p = get(ax2(1),'Children');
copyobj(ax2p, ax1(1));
For n figures you would simply use a for-loop to copy all objects.
  8 Kommentare
Pritesh gamit
Pritesh gamit am 10 Mär. 2021
Thank you sir. It helped me a lot. now i can see both figure in only one window.
mohammed
mohammed am 15 Aug. 2022
an you help me in 4 figures?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (7)

Benjamin
Benjamin am 14 Jan. 2021
Thanks for the solution, however, I don't know why it is not working on two figures of mine (attached here). I appreciate it if anybody can tell me what am I missing that the merging doesn't happen!
Regards,
  1 Kommentar
Alok kumar Baranwal
Alok kumar Baranwal am 28 Jul. 2022
Solution seems good. But dont know, when i am going to do it. its not being copy and paste. Instead its pasting its own line of Figure.

Melden Sie sich an, um zu kommentieren.


MAQBUL
MAQBUL am 13 Mai 2015
SUCH A NICE SOLUTION......

F Garcia
F Garcia am 13 Mär. 2017
Thanks, Mischa, and sorry to re-open the issue, but . . . what's happen with the legends (if they exists?). The one associated to ax2 is not shown !! (In both cases: either the copy-paste method or the programmatic one).

NEELU
NEELU am 4 Aug. 2018
thank you

MD ABDULLAH AL HASAN
MD ABDULLAH AL HASAN am 8 Feb. 2019
Great solution. Easy and simple.

Hesam Farhangfar
Hesam Farhangfar am 26 Feb. 2019
The forum needs more solutions like this.

Hayder Gallas
Hayder Gallas am 19 Feb. 2020
Thx, that was really helpful

Kategorien

Mehr zu Graphics Objects finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by