How do I control the Azimuth and Declination view angles of a 3D Plot?
3 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!