mapByGroup: Draw a Map using Different Colored Symbols for Groups

Description Usage Arguments Examples

View source: R/mapByGroup.R

Description

Draw a map using different colored symbols for different groups.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
mapByGroup(
  bygroup,
  sug = sort(unique(bygroup)),
  addMean = TRUE,
  lon,
  lat,
  rlon = range(lon, na.rm = TRUE),
  rlat = range(lat, na.rm = TRUE),
  cushion = 0.1,
  colorz = NULL,
  pch = 1,
  cex = 1.5,
  mapcol = "gray",
  mar = c(0, 0, 2, 0)
)

Arguments

bygroup

Vector, identifying the group membership of the locations to be mapped.

sug

Vector, identifying the unique groups to which locations may belong, default sort(unique(bygroup)).

addMean

Logical scalar indicating if group names should be added to plot at the mean location of each bygroup, default TRUE.

lon

A numeric vector of longitudes in decimal degrees.

lat

A numeric vector of latitudes in decimal degrees. Same length as lon.

rlon

A numeric vector of length 2, range of longitudes to map, in decimal degrees, default is the range of lon.

rlat

A numeric vector of length 2, range of latitudes to map, in decimal degrees, default is the range of lat.

cushion

A numeric scalar indicating the amount of cushion to add to the rlon and rlat ranges in decimal degrees, default 0.1.

colorz

A vector of colors to use, either of length 1 or the same length as lon. If NULL, the default, a range of colors will be assigned automatically.

pch

A vector of plotting characters or symbols, either of length 1 or the same length as lon, default 1. See points.

cex

A numeric vector giving the amount by which plotting characters and symbols should be scaled relative to the default, either of length 1 or the same length as lon, default 1.5.

mapcol

A scalar, the color used to draw the map lines (e.g., lake boundary), default "gray".

mar

A numeric vector of length 4, the number of lines of margin c(bottom, left, top, right) around the plotted map plot, default c(0, 0, 0, 0).

Examples

1
2
3
4
5
6
7
## Not run: 
 mygroup <- c(1, 1, 1, 2, 2, 2, 3, 3, 3)
 mylon <- -c(81.1, 81.2, 80.5, 83, 82.2, 82.7, 82.7, 82, 82.2)
 mylat <- c(45.7, 45.4, 45, 45.5, 45.4, 45, 44.4, 44.4, 43.9)
 mapByGroup(bygroup=mygroup, lon=mylon, lat=mylat, cushion=0.7)

## End(Not run)

JVAdams/EchoNet2Fish documentation built on Feb. 15, 2021, 4:27 a.m.