is2D

Tests whether an axes is shown as a flat 2-D plot.

Category: Other public functions: graphics

Syntax

tf = is2D(ax)

Returns true if the axes are in a 2-D view.

Description

An axes is 2-D when it looks straight down the z axis, as after plot. A surface or plot3 makes it 3-D, and so does rotating the view. Code that adds decorations can use is2D to choose between 2-D and 3-D variants of a call.

Input arguments

ax
Axes handle.

Output arguments

tf
Logical scalar.

Example

2-D and 3-D axes

plot(1:5)
is2D(gca)
surf(peaks(5))
is2D(gca)
Output
ans = logical
   1
ans = logical
   0

See also

view plot surf gca