Merging three 3D plots into one

조회 수: 15 (최근 30일)
Angelavtc
Angelavtc 2021년 10월 18일
댓글: Angelavtc 2021년 10월 19일
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