Main Content


Set or query camera view angle




camva returns the camera view angle setting in the current axes. The camera view angle determines the field of view of the camera. Larger angles produce a smaller view of the scene. Implement zooming by changing the camera view angle.

camva(view_angle) sets the view angle in the current axes to the specified value. Specify the view angle in degrees.

camva('mode') returns the current value of the camera view angle mode, which can be either auto (the default) or manual.

camva('auto') sets the camera view angle mode to auto.

camva('manual') sets the camera view angle mode to manual.

camva(axes_handle,...) performs the set or query on the axes identified by the first argument, axes_handle. When you do not specify an axes handle, camva operates on the current axes.


The camva function sets or queries values of the axes object CameraViewAngle and CameraViewAngleMode properties.

When the camera view angle mode is auto, the camera view angle adjusts so that the scene fills the available space in the window. If you move the camera to a different position, the camera view angle changes to maintain a view of the scene that fills the available area in the window.

Setting a camera view angle or setting the camera view angle to manual disables the MATLAB® stretch-to-fill feature (stretching of the axes to fit the window). This means setting the camera view angle to its current value,

can cause a change in the way the graph looks. See axes for more information.


collapse all

Create two push buttons, one that zooms in and another that zooms out. Set the range checking in the callback statements to keep the values for the camera view angle in the range greater than zero and less than 180. Then create a surface plot to zoom in and out on.

  'String','Zoom In',...
  'Position',[20 20 60 20],...
  'Callback','if camva <= 1; return; else; camva(camva-1); end');

  'String','Zoom Out',...
  'Position',[100 20 60 20],...
  'if camva >= 179; return; else; camva(camva+1); end');


Version History

Introduced before R2006a