objbounds

Data limits of the objects in an axes.

Category: Other public functions: graph3d

Syntax

b = objbounds(ax)

Returns the extent of the data drawn in ax.

Description

The function scans the children of the axes and reports the smallest box that contains their data. It is the information that automatic axis limits are based on, which makes it useful when a script needs the real extent of a plot rather than the current xlim and ylim. It is an internal helper without public documentation.

Input arguments

ax
Axes handle.

Output arguments

b
Row vector [xmin xmax ymin ymax zmin zmax]. For 2-D data the z limits are 0.

Example

Extent of a line

plot(1:3, [2 5 3])
b = objbounds(gca)
Output
b = 1×6

     1     3     2     5     0     0

See also

xlim ylim axis gca