linemap: Line Map

Description Usage Arguments Examples

View source: R/linemap.R

Description

Plot a line map.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
linemap(
  x,
  var,
  k = 2,
  threshold = 1,
  col = "white",
  border = "black",
  lwd = 0.5,
  add = FALSE
)

Arguments

x

a data.frame, two first column must be longitudes and latitudes of gridded data.

var

name of the variable to plot.

k

expension factor.

threshold

threshold of the data to plot.

col

color for the lines areas.

border

color for the lines borders.

lwd

thickness of the lines.

add

if TRUE add the lines to the current plot.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(linemap)
data("popOcc")
# example on an extract of the gridded data
popToulouse <- popOcc[findInterval(popOcc$X, c(3600234,3659444)) == 1  &
                        findInterval(popOcc$Y, c(2290913,2348192)) == 1, ]
opar <- par(mar=c(0,0,0,0), bg = "ivory1")
linemap(x = popToulouse, var = "pop", k = 2.5, threshold = 50,
        col = "ivory1", border = "ivory4", lwd = 0.6, add = FALSE)
par(opar)


# example on the full dataset
library(sf)
occitanie <- st_read(system.file("gpkg/geofla.gpkg", package = "linemap"),
                     layer = "Occitanie")
opar <- par(mar=c(0,0,0,0), bg = "ivory2")
plot(st_geometry(occitanie), col="ivory1", border = NA)
linemap(x = popOcc, var = "pop", k = 2.5, threshold = 50,
        col = "ivory1", border = "ivory4", lwd = 0.6, add = TRUE)
par(opar)

linemap documentation built on Jan. 19, 2021, 5:06 p.m.