R/Plot.R
plot_lon_lat.Rd
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,
...
)
A data.table with data, including the longitude and latitude variables specified by the arguments lon_name
and lat_name
.
An sf object with multipolygons.
Logical: If TRUE show the map.
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.
Character: The name of the longitude and latitude variable in the data x
.
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).
The type of plot. See Details.
The line type as described in aes_linetype_size_shape
.
Numeric: The width of the track lines.
Numeric: The width of the polygon borders.
Either a numeric value or the name of the variable to set the size by.
Numeric: The maximum size of the points (presumably ignored if size
is numeric).
Numeric: A value between 0 and 1 setting the width of the point symbols relative to their size.
Character: The color of the track points
Character: The color of the track lines.
Character: The name of the function defining the color scale in case color
names a variable in the data x
.
Character: The colors to use for the land, the borders between countries, the ocean and the grid in the map.
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).
Character: The color of the borders between poygons.
Numeric: The shape of the points as specified in points
. Could possibly also be a character.
Numeric: The alpha (transparency) values between 0 and 1 for the points, track lines and polygons.
Numeric: The zoom of the plot, where 1 is no zoom and 2 zooms out to double extent of the plot, etc.
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.
Numeric: The center of the plot relative to the limits of the plot before zooming.
Character: The main title of the plot.
Character: Text to be added to the plot using annotate
at the positions specified by x.text
, y.text
, hjust.text
and vjust.text
.
Character: The size of the text.
Character: The color of the text.
Adjustment of the text position. See annotate
.
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.
The type
can have the following values:
Track lines on top of points
Points on top of track lines
Segments on top of points
Points on top of segments
Only points
Only segments
Olny lines