VIEW Set Graphical View

Section: Handle-Based Graphics

Usage

The view function sets the view into the current plot. The simplest form is
  view(n)

where n=2 sets a standard view (azimuth 0 and elevation 90), and n=3 sets a standard 3D view (azimuth 37.5 and elevation 30). With two arguments,

  view(az,el)

you set the viewpoint to azimuth az and elevation el.

Example

Here is a 3D surface plot shown with a number of viewpoints. First, the default view for a 3D plot.
--> x = repmat(linspace(-1,1),[100,1]);
--> y = x';
--> r = x.^2+y.^2;
--> z = exp(-r*3).*cos(5*pi*r);
--> surf(x,y,z);
--> axis equal
--> view(3)
Warning: Newly defined variable xlim shadows a function of the same name.  Use clear xlim to recover access to the function
Warning: Newly defined variable ylim shadows a function of the same name.  Use clear ylim to recover access to the function
Warning: Newly defined variable zlim shadows a function of the same name.  Use clear zlim to recover access to the function

Next, we look at it as a 2D plot

--> surf(x,y,z);
--> axis equal
--> view(2)
Warning: Newly defined variable xlim shadows a function of the same name.  Use clear xlim to recover access to the function
Warning: Newly defined variable ylim shadows a function of the same name.  Use clear ylim to recover access to the function
Warning: Newly defined variable zlim shadows a function of the same name.  Use clear zlim to recover access to the function

Finally, we generate a different view of the same surface.

--> surf(x,y,z);
--> axis equal
--> view(25,50);
Warning: Newly defined variable xlim shadows a function of the same name.  Use clear xlim to recover access to the function
Warning: Newly defined variable ylim shadows a function of the same name.  Use clear ylim to recover access to the function
Warning: Newly defined variable zlim shadows a function of the same name.  Use clear zlim to recover access to the function