Create viewport from sf, sfc or sfg object

st_viewport(x, ..., bbox = st_bbox(x), asp)

Arguments

x object of class sf, sfc or sfg object parameters passed on to viewport the bounding box used for aspect ratio numeric; target aspect ratio (y/x), see Details

Value

The output of the call to viewport

Details

parameters width, height, xscale and yscale are set such that aspect ratio is honoured and plot size is maximized in the current viewport; others can be passed as ...

If asp is missing, it is taken as 1, except when isTRUE(st_is_longlat(x)), in which case it is set to 1.0 /cos(y), with y the middle of the latitude bounding box.

Examples

library(grid)
#> Reading layer nc' from data source /tmp/RtmpzFUSyK/temp_libpath50b861ca5d63/sf/shape/nc.shp' using driver ESRI Shapefile'
`