plotGeo: Function to plot cases on a map

Description Usage Arguments Author(s) Examples

View source: R/plotGeo.R

Description

Function to plot the geographic distribution of data in an obkData.

Usage

1
2
  plotGeo(x, location=NULL, zoom='auto', source='google',
          colorBy=NULL, shapeBy=NULL, center=NULL, ...)

Arguments

x

the main obkData object

location

the name of the columns containing location data; if a vector of length 2 is provided, these are expected to be longitudes and latitudes.

zoom

a numeric indicating the level of zooming; higher number gives smaller scale (higher zoom).

source

a character string indicating the internet source from which to download maps.

colorBy

the name of the attribute to use for coloring the symbols.

shapeBy

the name of the attribute to use for shaping the symbols.

center

individualID of individual to put at the center of the map. If left empty, method will focus on the center of all points

...

further arguments passed to geom_point.

Author(s)

Original version by Rolf Ypma. Tweaks by Thibaut Jombart.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
## load the obkData of equine influenza outbreak
data(HorseFlu)
x <- HorseFlu

## plot the individuals on a map
plotGeo(x,location=c('lon','lat'),zoom=8)

## color by sex
plotGeo(x,location=c('lon','lat'),zoom=8,colorBy='sex')

## zoom in on the small cluster, by centering on individual '9'
plotGeo(x,location=c('lon','lat'),colorBy="sex",zoom=14,center='9',size=4,
  alpha=(.7))

plotGeo(x,location=c('lon','lat'),colorBy="yardID", shapeBy="sex", zoom=14,center='9',size=4,
  alpha=(.7))

## another example ##
## load obkData object containing data about a simulated outbreak
data(ToyOutbreak)

## plot the individuals on a map
plotGeo(ToyOutbreak,location=c('lon','lat'), zoom=8)
plotGeo(ToyOutbreak,location=c('lon','lat'), zoom=13, colorBy='Sex', size=3)

## color by age, zooming on the first case of the outbreak: indivudal 1
plotGeo(ToyOutbreak,location=c('lon','lat'), zoom=15,
        colorBy='Age', center='1', size=5)

## End(Not run)

OutbreakTools documentation built on Oct. 6, 2017, 1:03 a.m.