linking two axes with rotate3D

18 次查看(过去 30 天)
I have two plots in a figure:
ax1 = subplot(1,2,1); surf(peaks); ax2 = subplot(1,2,2); surf(membrane);
Now rotate3d can rotate the data. I want to use it on axes 1 and want callback to automatically rotate the membrane plot with the same angle
I tried to get it using the post callback function but I am not successful.
function mypostcallback(obj,evd) k=get(obj,'Children') newView = round(get(evd.Axes,'View')) axes(k(end)) % hopnig my second axes is the last one. view([newView])
Can someone help me?

采纳的回答

José-Luis
José-Luis 2012-12-23
h(1) = figure(1);
v(1) = plot3(rand(10,1),rand(10,1),rand(10,1));
h(2) = figure(3);
v(2) = plot3(rand(10,1),rand(10,1),rand(10,1));
aH = cell2mat(ancestor(v,'axes'));
linkprop(aH,'CameraPosition');
The two plots should rotate together now.

更多回答(1 个)

Gaurav Rayal
Gaurav Rayal 2012-12-25
Thanks a lot Jose.

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by