Merging three 3D plots into one

15 次查看(过去 30 天)
Dear community,
How can I merge three different 3D plots into one? My figures are saved in .fig (here I attach them), and I would like to plot them in the same graph to compare them. Is it possible to change the color of each of them and put a label to compare them properly? I have seen in the forum that I can apply the commands:
findobj
and
copyobj
but I don't know how they properly work.
Thanks in advance!

采纳的回答

Dave B
Dave B 2021-10-18
You can copy the surfaces from each of the axes, in each of the figures that you open like this:
a=open('BandL_my_replication_variance.fig');
b=open('BandL_my_replication_variance_c2.fig');
c=open('BandL_my_replication_variance_concave.fig');
s1=findobj(a,'type','Surface');
s2=findobj(b,'type','Surface');
s3=findobj(c,'type','Surface');
ax=axes(figure);
s1=copyobj(s1,ax);
s2=copyobj(s2,ax);
s3=copyobj(s3,ax);
close([a b c])
Then you can adjust the color on those surfaces like this:
s1.FaceColor='r';
s2.FaceColor='g';
s3.FaceColor='b';
And finally pick a view that you can see them like this:
view([32 23])
(I didn't copy over the x/y/z labels or add a legend but that part should be relatively simple)
  3 个评论
Dave B
Dave B 2021-10-18
How about something like this? I used a black plane that spans the limits of the x and y axes, but a bit of transparency so we can see the stuff under 0. Not sure that will accomplish your goal of differentiating but maybe? (your example above seemed to have all positive z)
surf(xlim,ylim,zeros(2),'FaceColor','k','FaceAlpha',.2)
Angelavtc
Angelavtc 2021-10-19
This is perfect, thank you very much @Dave B. Yes, the graphs I attached are all positive, but I will apply the same code for others where this is not the case :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by