view
Sets or gets the viewing angle of 3-D axes as azimuth and elevation.
Category: Graphics > Formatting and Annotation
Syntax
view(az, el)
Sets the azimuth and elevation, in degrees.
view(2)
Uses the default 2-D view, [0 90], looking down the z-axis.
view(3)
Uses the default 3-D view, [-37.5 30].
[az, el] = view
Returns the current angles.
Description
The two angles describe where the viewer stands relative to the axes. view(0, 90) is a top view, view(0, 0) looks along the y-axis from the front, and view(90, 0) looks from the side. For 2-D plots the default is [0 90].
The viewpoint is stored in the axes property View. Rotating the axes by mouse changes it as well.
Input arguments
az- Azimuth: the rotation about the vertical axis, in degrees. Positive values turn the viewpoint counterclockwise as seen from above.
el- Elevation: the angle above the xy plane, in degrees. 90 looks straight down.
Output arguments
az, el- Current azimuth and elevation. With one output, a two-element vector
[az el].
Example
Look from the side
surf(peaks(25))
view(3);
v3 = view
view(90, 0)
v = view
Output
v3 = 1×2
-37.5000 30.0000
v = 1×2
90 0
Notes
In MatLivre the form view([x y z]), which takes a direction vector, is not supported; give azimuth and elevation instead.