How to combine two plots into one with separate markers

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

 採用された回答

Mischa Kim
Mischa Kim 2014 年 7 月 23 日
編集済み: Mischa Kim 2014 年 7 月 23 日

26 投票

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 件のコメント

Vaultec
Vaultec 2014 年 7 月 23 日
how would i go about setting them to separate markers automatically?, sorry a bit new to matlab so I'm not quite sure how to do that and write a for loop
Alvaro Canivell
Alvaro Canivell 2016 年 2 月 15 日
easy and quick, thanks
anurag rai
anurag rai 2016 年 6 月 24 日
thanks, its very easy and helpful .
Sean
Sean 2016 年 8 月 16 日
how does the for loop works?
Joel Fernandez
Joel Fernandez 2020 年 4 月 7 日
thank you! it works for 2 .fig files
could you please show us how it should be for 3 .fig files? ... then I will do the for-loop for n figures by myself (promise)
Amil Daraz
Amil Daraz 2020 年 4 月 30 日
Could you explain for four figures?
Pritesh gamit
Pritesh gamit 2021 年 3 月 10 日
Thank you sir. It helped me a lot. now i can see both figure in only one window.
mohammed
mohammed 2022 年 8 月 15 日
an you help me in 4 figures?

サインインしてコメントする。

その他の回答 (7 件)

Benjamin
Benjamin 2021 年 1 月 14 日

1 投票

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 件のコメント

Alok kumar Baranwal
Alok kumar Baranwal 2022 年 7 月 28 日
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.

サインインしてコメントする。

MAQBUL
MAQBUL 2015 年 5 月 13 日

0 投票

SUCH A NICE SOLUTION......
F Garcia
F Garcia 2017 年 3 月 13 日

0 投票

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).
MD ABDULLAH AL HASAN
MD ABDULLAH AL HASAN 2019 年 2 月 8 日

0 投票

Great solution. Easy and simple.
Hesam Farhangfar
Hesam Farhangfar 2019 年 2 月 26 日

0 投票

The forum needs more solutions like this.
Hayder Gallas
Hayder Gallas 2020 年 2 月 19 日

0 投票

Thx, that was really helpful

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

質問済み:

2014 年 7 月 23 日

コメント済み:

2022 年 8 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by