Merging three 3D plots into one
15 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Dave B
on 18 Oct 2021
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 Comments
Dave B
on 18 Oct 2021
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)
More Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!