Learn R Programming

insetplot (version 1.4.0)

get_bbox_features: Extract width, height, and aspect ratio from a bounding box

Description

Computes spatial range and aspect ratio metrics from a bounding box.

Usage

get_bbox_features(bbox)

Value

A list with elements:

x_range

Width (xmax - xmin) of the bounding box

y_range

Height (ymax - ymin) of the bounding box

xy_ratio

Aspect ratio (x_range / y_range)

Arguments

bbox

A named numeric vector with elements xmin, xmax, ymin, ymax.

Examples

Run this code
# Create a sample bounding box
bbox <- c(xmin = -84, xmax = -75, ymin = 33, ymax = 37)

# Extract width, height, and aspect ratio
features <- get_bbox_features(bbox)
features

# Access individual components
features$x_range
features$y_range
features$xy_ratio

Run the code above in your browser using DataLab