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

plot_lon_lat(
  trackData,
  stationData = NULL,
  polygon,
  showMap = TRUE,
  trackLinesBy = NULL,
  lon_name = "lon",
  lat_name = "lat",
  lon_name_end = NULL,
  lat_name_end = NULL,
  lon_name_station = "lon",
  lat_name_station = "lat",
  trackType = c("pl", "lp", "ps", "sp", "p", "s", "l"),
  linetype.track = 1,
  linewidth.track = 1,
  linewidth.polygon.border = 0.5,
  size = 1,
  size.max = 10,
  size.station.point = 2,
  strokeToPointFactor = 0.1,
  color.track.point = 1,
  color.track = 1,
  color.scale = combined.color(2),
  color.station.point = 1,
  color.land = "grey50",
  color.border = "grey10",
  color.ocean = "grey90",
  color.grid = "white",
  color.polygon = "hue",
  color.polygon.border = "blue",
  shape = 16,
  shape.station.point = 0,
  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

trackData

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

stationData

A data.table with track data, including the longitude and latitude variables specified by the arguments lon_name_station and lat_name_station.

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 TransectDesignData so that the transit between strata is not shown.

lon_name, lat_name

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

lon_name_end, lat_name_end

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

lon_name_station, lat_name_station

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

trackType

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

size.station.point

Numeric: The size of the station points.

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.station.point

Character: The color to use for the station points, defaulted to "black".

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.

shape.station.point

The shape of the station points, as defined for the argument pch in points.

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 trackType 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