PyNGL Home > Functions > Graphics routines

Ngl.get_bounding_box

Retrieves the NDC bounding box values for the given object.

Available in version 1.3.1 or later.

Prototype

top,bottom,left,right = Ngl.get_bounding_box(plotid)

Arguments

plotid

The identifier returned from Ngl.open_wks, or any PyNGL function that returns a PlotId.

Return values

top, bottom, left, right

Four scalars representing, in NDC space, the topmost, bottommost, leftmost, and rightmost edges of the given plot's space.

Description

This function returns the bounding box values that enclose the given plot object. The bounding box is different than the viewport resources vpXF, vpYF, vpWidthF, vpHeightF, as it includes the area around the titles, tickmarks, tickmark labels, labelbar, etc.

The first argument is a PlotId and the second argument is the resource whose value you want to retrieve.

See Also

View resources

Examples

. . .
plot = Ngl.contour(wks,data,cnres)
bb   = Ngl.get_bounding_box(plot)    ; top, bottom, left, right
. . .
See viewport1.py (output) in the gallery.