How to combine two plots into one with separate markers
47 次查看(过去 30 天)
显示 更早的评论
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
2014-7-23
编辑:Mischa Kim
2014-7-23
Jimmy, as a very efficient approach (if you only need to do it once) I recommend a simple copy-paste:
- Open both figures
- Select "Show Plot Tools and Dock Figure" in both figures (see figure below)
- Select one of the plot lines and copy [CTRL+C]
- Paste [CTRL+V] in the other plot
- Change the line properties to your liking
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175276/image.png)
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 个评论
Pritesh gamit
2021-3-10
Thank you sir. It helped me a lot. now i can see both figure in only one window.![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/545487/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/545487/image.png)
更多回答(7 个)
Benjamin
2021-1-14
1 个评论
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.
F Garcia
2017-3-13
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).
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!