Learn R Programming

swfscMisc (version 1.1)

sample.map: Plot Samples on World Map

Description

Plot a set of samples on a world map.

Usage

sample.map(lat, lon, lat.range = NULL, lon.range = NULL, main = NULL, pch = 19, pt.cex = 1, col = "black", bg = col, n = 5, lon.n = n, lat.n = n)

Arguments

lon, lat
vectors giving the longitude and latitude of points to plot.
lon.range, lat.range
vectors giving the minimum and maximum longitude and latitude of the map. If the first value in lon.range is greater than the second value, then a Pacific-centric map (world2Hires) is used and continents will not be filled in.
main
main title for the plot.
pch
point symbol to use.
pt.cex
point size to use.
col
point color.
bg
background color of point.
n, lon.n, lat.n
the number of tick marks desired. Can be specified separately for longitude (lon.n) or latitude (lat.n). See pretty for more details.

Value

original par settings for mar and oma.

See Also

lat.lon.axes

Examples

Run this code

# Some random points around San Diego, CA
lat <- runif(30, 32.5, 33.3)
lon <- runif(30, -118.3, -117.5)
lat.range <- c(32.4, 33.6)
lon.range <- c(-118.6, -117)
sample.map(lat, lon, lat.range, lon.range)

# Some random points in the Pacific
lat <- runif(30, 20, 50)
lon <- c(runif(15, 150, 180), runif(15, -180, -120))
lat.range <- c(10, 75)
lon.range <- c(110, -110)
sample.map(lat, lon, lat.range, lon.range)

Run the code above in your browser using DataLab