This function is applied by plot_lon_lat() to set the zoom based on 0 or more arguments and the actual data to be plotted. Providing no arguments returns the full extent of the data.

zoom_lon_lat(
  x,
  lon_name = "lon",
  lat_name = "lat",
  xmin = NA,
  xmax = NA,
  ymin = NA,
  ymax = NA,
  zoom = 1,
  zoomCenter = c(0.5, 0.5)
)

Arguments

x

A data.table with data, including the longitude and latitude variables specified by the arguments lon_name and lat_name.

lon_name, lat_name

Character: The name of the longitude and latitude variable in the data x.

xmin, xmax, ymin, ymax

Numeric: The optional extremes of the plot, where x is longitude and y is latitude. Setting only xmin sets only the lower longitude limit, etc.

zoom

Numeric: The zoom of the plot, where 1 is no zoom and 2 zooms out to double extent of the plot, etc.

zoomCenter

Numeric: The center of the plot relative to the limits of the plot before zooming.