How do I control the Azimuth and Declination view angles of a 3D Plot?
2 次查看(过去 30 天)
显示 更早的评论
Say I generate a GUI which has a 3d Plot/Surf in it. I want to know the best way to add user controls to manipulate the angle of view for the plot. Ie. the azimuth and declination.
I've had a look at axes properties, in order to try to get an understanding of the method in which MATLAB defines the view of a 3d plot. It seems to define a CameraPosition and "Up-Axis".
I was wondering if there's a quick and simple way to change the view without having to activate MATLAB's own 3DRotate within the figure?
Attached is some simple code below, which show's roughly what I'm on about. Ideally I'd like to create callback functions for the 2 sliders (s1 and s2) in order to alter the view accordingly.
%%QUICK EXAMPLE
%%Plot Data
a=rand(10); %Random Matrix
f=figure(); %Figure Window
s=surf(a); %Surface Plot
ax=gca; %Get Axis Handle
%%Add Sliders
s1=uicontrol('Style','Slider','Units','Normalized','Position',...
[0.05,0.05,0.3,0.05],'Tag','Azimuth','Min',-180,'Max',180,...
'Value',0);
s2=uicontrol('Style','Slider','Units','Normalized','Position',...
[0.65,0.05,0.3,0.05],'Tag','Declination','Min',-90,'Max',90,...
'Value',0);
Thanks,
Gav
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!