Plot a map, an optional (multi)polygon, and points and a track given by the first argument.

plot_lon_lat(
  x,
  polygon,
  showMap = TRUE,
  trackLinesBy = NULL,
  lon_name = "lon",
  lat_name = "lat",
  lon_name_end = NULL,
  lat_name_end = NULL,
  type = c("pl", "lp", "ps", "sp", "p", "s", "l"),
  linetype.track = 1,
  linewidth.track = 1,
  linewidth.polygon.border = 0.5,
  size = 1,
  size.max = 10,
  strokeToPointFactor = 0.1,
  color.track.point = 1,
  color.track = 1,
  color.scale = combined.color(2),
  color.land = "grey50",
  color.border = "grey10",
  color.ocean = "grey90",
  color.grid = "white",
  color.polygon = "hue",
  color.polygon.border = "blue",
  shape = 16,
  alpha.point = 1,
  alpha.track = 1,
  alpha.polygon = 1,
  zoom = 1,
  xlim = NA,
  ylim = NA,
  zoomCenter = c(0.5, 0.5),
  main = NULL,
  text = NULL,
  size.text = 4,
  color.text = "black",
  hjust.text = 0.5,
  vjust.text = 0.5,
  x.text = NULL,
  y.text = NULL,
  ...
)

Arguments

x

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

polygon

An sf object with multipolygons.

showMap

Logical: If TRUE show the map.

trackLinesBy

Character: A grouping variable for the track lines. Typically this could be Stratum for a plot of a SurveyPlan so that the transport between strata is not shown.

lon_name, lat_name

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

lon_name_end, lat_name_end

Character: The name of the end point of the longitude and latitude variable in the data x, used in the case that type contains "s" (segments).

type

The type of plot. See Details.

linetype.track

The line type as described in aes_linetype_size_shape.

linewidth.track

Numeric: The width of the track lines.

linewidth.polygon.border

Numeric: The width of the polygon borders.

size

Either a numeric value or the name of the variable to set the size by.

size.max

Numeric: The maximum size of the points (presumably ignored if size is numeric).

strokeToPointFactor

Numeric: A value between 0 and 1 setting the width of the point symbols relative to their size.

color.track.point

Character: The color of the track points

color.track

Character: The color of the track lines.

color.scale

Character: The name of the function defining the color scale in case color names a variable in the data x.

color.land, color.border, color.ocean, color.grid

Character: The colors to use for the land, the borders between countries, the ocean and the grid in the map.

color.polygon

The color to use for the polygons, given either as a single color equal for all strata or a color palette. The default, "hue", is the default color ggplot palette. See the Palettes section in scale_fill_brewer for a list of options (both Diverging, Qualitative and Sequential color palettes are possible).

color.polygon.border

Character: The color of the borders between poygons.

shape

Numeric: The shape of the points as specified in points. Could possibly also be a character.

alpha.point, alpha.track, alpha.polygon

Numeric: The alpha (transparency) values between 0 and 1 for the points, track lines and polygons.

zoom

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

xlim, ylim

The optional x and y limit of the plot. These are vectors of length 2. NA can be used to leave on of the values unset. The full extent of the data are used when these are not specified.

zoomCenter

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

main

Character: The main title of the plot.

text

Character: Text to be added to the plot using annotate at the positions specified by x.text, y.text, hjust.text and vjust.text.

size.text

Character: The size of the text.

color.text

Character: The color of the text.

hjust.text, vjust.text

Adjustment of the text position. See annotate.

x.text, y.text

Numeric: The positions of the text.

...

Optional arguments, specifically axis.title.size.x, axis.title.size.y, axis.text.size.x,axis.text.size.y, legend.text.size and legend.title.size.

Details

The type can have the following values:

pl

Track lines on top of points

lp

Points on top of track lines

ps

Segments on top of points

sp

Points on top of segments

p

Only points

s

Only segments

l

Olny lines