map: Make a map of points

View source: R/map.R

mapR Documentation

Make a map of points

Description

A function that creates a plot of points on a background map pulled from Google Maps' API.

Usage

map(
  x,
  data = parent.frame(),
  e,
  scaleby,
  size = 1,
  col = "blue",
  zoom = 10,
  color,
  ...
)

Arguments

x

Function of the form latitude~longitude

data

Data frame containing latitude and longitude variables

scaleby

A variable for bubbles to be scaled by in a bubble plot.

size

Size of the points. Default is 1, larger numbers will make points larger.

col

A specification for the plotting color. Defaults to "blue". You can provide any color name here, like "red", "purple", etc., in quotes. Or, you could use hex values like "FF00FF", again in quotes. See section 'Color Specification' in the par documentation for more.

dots

graphical parameters to be passed to points. For example, you could change the size of the dots on the map by passing cex=2.

Details

Creates a map using a Google Maps basemap, with points of data on top. Points can be colored differently and sized according to another variable

Value

A map of points with a google map background

Examples

lat <- runif(10, 32, 42)
lon <- runif(10, -124, -114)
geodata <- data.frame(lat, lon)
scale <- sample(1:10, 10)
map(lat~lon, data=geodata)
map(lat~lon, data=geodata, scaleby = scale)
map(lat~lon, data=geodata, scaleby = scale, size = 5)
map(lat~lon, data=geodata, col = type)
map(lat~lon, data=geodata, scaleby = scale, col = type)

mobilizingcs/mobilizr documentation built on Feb. 17, 2024, 7:49 p.m.