Learn R Programming

SDLfilter (version 1.2.1)

plotMap: Plot location data

Description

Function to easily plot locations on a map or a satellite image.

Usage

plotMap(sdata, xlim = NULL, ylim = NULL, margin = 10, bgmap = NULL,
  google.key = NULL, map.bg = "grey", map.col = "black",
  zoom = "auto", point.bg = "yellow", point.col = "black",
  point.symbol = 21, point.size = 1, line.col = "lightgrey",
  line.type = 1, line.size = 0.5, sb.distance = NULL, sb.lwd = 1,
  sb.line.col = "black", sb.text.size = 4, sb.text.col = "black",
  sb.space = 3, title = "id", title.size = 11, axes.text.size = 11,
  axes.lab.size = 11, multiplot = TRUE, nrow = 1, ncol = 1)

Arguments

sdata

A data frame containing columns with the following headers: "id", "DateTime", "lat", "lon". A map is created for each subset of location data grouped by the unique "id". "DateTime" is date & time in class POSIXct. "lat" and "lon" are the recorded latitude and longitude in decimal degrees.

xlim

Limits for x axis. If not specified, the values are determined as the maximum range of the input data with an additional margin (see margin).

ylim

Limits for x axis. See xlim for details.

margin

Set the amount of spaces added around the periphery of the plot. The value is scaled to the plot. The smaller value increases the margin.

bgmap

A data.frame of a background map data, containing the following headers: "long", "lat", "group". If not specified, the "world" map provided by the maps package is used. The Google Maps ("terrain", "satellite", "roadmap", "hybrid") can also be queried.

google.key

If the Google Maps are queried, a valid API key (a string) needs to be specified here. See register_google for details.

map.bg

Background colour of the map. This argument is ignored when any of the Google Maps is selected.

map.col

Outline colour of the map. This argument is ignored when any of the Google Maps is selected.

zoom

Map zoom for the Google Maps. See get_map for details.

point.bg

The colour to fill in a symbol.

point.col

The colour for the outline of a symbol.

point.symbol

An integer or a string to specify the symbol type. See shape for details.

point.size

An integer to specify the size of the symbol.

line.col

The colour of the line that connects consecutive points.

line.type

The type of the line that connects consecutive points. See linetype for details.

line.size

An integer to specify the thickness (width) of the line that connects consecutive points.

sb.distance

An integer to specify the length of the scale bar. If not specified, approximately a quarter of the plotting range will be used.

sb.lwd

An integer to specify the thickness (width) of the scale bar.

sb.line.col

The colour of the scale bar.

sb.text.size

An integer to specify the text size for the scale bar.

sb.text.col

The colour of the text for the scale bar.

sb.space

Set the amount of space between the scale bar and the text for the scale bar. The value is scaled to the plot. The smaller value increases the space.

title

The main title for each plot. If not specified, the "id" will be used.

title.size

An integer to specify the size of the title.

axes.text.size

An integer to specify the size of the axes characters.

axes.lab.size

An integer to specify the size of the axes labels.

multiplot

Logical. If TRUE (default), multiple plots are displayed on the same page.

nrow

An integer to specify the number of rows in the multiple plot page.

ncol

An integer to specify the number of columns in the multiple plot page.

Value

An arrangelist is returned when multiplot is TRUE. Otherwise a list is returned.

See Also

dupfilter, ddfilter, est.vmax, est.maxvlp

Examples

Run this code
# NOT RUN {
#### Load data sets
## Fastloc GPS data obtained from two green turtles
data(turtle)
data(turtle2)
turtles<-rbind(turtle, turtle2)

#### Filter temporal and/or spatial duplicates
turtle.dup <- dupfilter(turtles, step.time=5/60, step.dist=0.001)
 

#### ddfilter
V <- est.vmax(turtle.dup)
VLP <- est.maxvlp(turtle.dup)
turtle.dd <- ddfilter(turtle.dup, vmax=V, maxvlp=VLP)


#### Plot filtered data for each animal
## using the low-resolution world map
plotMap(turtle.dd, point.size = 2, line.size = 0.5, axes.lab.size = 0, ncol=2, nrow=1)

# }
# NOT RUN {
## using the high-resolution google satellite images
plotMap(turtle.dd, point.size = 2, line.size = 0.5, axes.lab.size = 0, ncol=2, nrow=1, 
        bgmap = "satellite", sb.line.col = "white", sb.text.col = "white", key = "an_api_key")
# }

Run the code above in your browser using DataLab