psegments: Projected segments function

Description Usage Arguments Details See Also Examples

View source: R/psegments.R

Description

psegments takes pairs of coordinates and draws line segments between them, possibly after projection.

Usage

1
psegments(x0, y0, x1 = x0, y1 = y0, proj, ...)

Arguments

x0, y0

coordinates of points from which to draw.

x1, y1

coordinates of points to which to draw

proj

A character string indicating what projection should be used for the included x and y coordinates. The default is "none". The other valid choices correspond to the "projection" argument in the mapproject function, which is used for the projection.

...

Additional arguments to pass to the segments function.

Details

The mapproject function is used for projection.

See Also

segments, mapproject, pimage

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(narccap)
# plot image using bonne projection (w/o grid lines)
pimage(lon, lat, tasmax[,,1], proj = "bonne",
       parameters = 40, paxes.args = list(grid = FALSE))
# some locations for u.s. cities
# taken from data(us.cities, package = "maps")
boston <- c(-71.02, 42.34)
la <- c(-118.41, 34.11)
ny <- c(-73.94, 40.67)
sf <- c(-122.45, 37.77)
# plot segments between sf, la and ny boston
x0 <- c(sf[1], ny[1])
y0 <- c(sf[2], ny[2])
x1 <- c(la[1], boston[1])
y1 <- c(la[2], boston[2])
psegments(x0, y0, x1, y1, proj = "bonne", lwd = 3)
citycoords <- rbind(sf, la, ny, boston)
cityxy <- list(x = citycoords[,1], y = citycoords[,2])
citynames <- c("san francisco", "los angeles", "new york", "boston") 
ptext(cityxy, labels = citynames, proj = 'bonne')

autoimage documentation built on March 16, 2021, 5:07 p.m.