Learn R Programming

ggOceanMaps (version 1.1)

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 = "+init=epsg:4326",
  proj.out = NULL,
  expand.factor = NULL,
  verbose = TRUE
)

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 proj4string 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.

rotate

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

Value

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

Details

This is an internal function, which is automatically run by the basemap function. The function does some funky illogical action (seeing the argument names) when feeding in projected coordinates. This is to make the automatic limits to work for projected coordinates too. Despite the funkiness, the function may be useful when customising basemaps.

See Also

Other customize shapefiles: reorder_layers(), theme_map()

Examples

Run this code
# NOT RUN {
auto_limits(data = expand.grid(lon = c(-120, 180, 120), lat = c(60, 60, 80)))
# }

Run the code above in your browser using DataLab