Learn R Programming

ggOceanMaps (version 1.3.4)

auto_limits: Automatic limits for basemap

Description

Find limits for a basemap from a data frame.

Usage

auto_limits(
  data,
  lon = NULL,
  lat = NULL,
  proj.in = 4326,
  proj.out = NULL,
  expand.factor = NULL,
  verbose = FALSE,
  output.sf = FALSE
)

Value

A list of limits and projections in proj.in and proj.out formats.

Arguments

data

Data frame containing data for which the limits should be calculated.

lon, lat

Names of longitude and latitude columns in data as character or integer index. If NULL, the column names are guessed.

proj.in

Original CRS projection. Must be defined as character argument.

proj.out

Resulting map projection. See transform_coord.

expand.factor

Expansion factor for map limits. Set to NULL to ignore.

verbose

Logical indicating whether information about the projection and guessed column names should be returned as message. Set to FALSE to make the function silent.

output.sf

Logical indicating whether an sf (TRUE) or sp (FALSE) polygon should be returned.

rotate

Logical indicating whether the limits should be rotated to point towards the pole relative to mid-longitude limit.

Author

Mikko Vihtakari

Details

This is an internal function, which is automatically run by the basemap function.

See Also

Other customize shapefiles: reorder_layers(), theme_map()

Examples

Run this code
if(requireNamespace("ggOceanMapsData")) {
auto_limits(data = expand.grid(lon = c(-120, 180, 120),
   lat = c(60, 60, 80)))
}

Run the code above in your browser using DataLab