Learn R Programming

plotGoogleMaps (version 2.2)

pieSP: Create pie charts data in form of SpatialPolygonsDataFrame.

Description

Create pie charts data in form of SpatialPolygonsDataFrame depending on few attributes.

Usage

pieSP(SPDF, zcol=1:length(SPDF@data), scalelist=TRUE, max.radius=100, do.sqrt = TRUE )

Arguments

SPDF
object of SpatialPointsDataFrame-class with associated coordinate reference systems
zcol
variable column names, or column numbers after removing spatial coordinates from x@data: 1 refers to the first non-coordinate column
scalelist
if TRUE circles are different in size, FALSE all circles have same radius
max.radius
value for maximum radius in meter
do.sqrt
logical; if TRUE the plotting symbol area (sqrt(diameter)) is proportional to the value of the z-variable; if FALSE, the symbol size (diameter) is proportional to the z-variable

Value

See Also

pieSP, elSPDF, bubbleSP

Examples

Run this code
# Data preparation
data(meuse)
coordinates(meuse)<-~x+y
proj4string(meuse) <- CRS('+init=epsg:28992')

pies<-pieSP(meuse,zcol=c('zinc','lead','copper'), max.radius=120)
pies$pie=rep(c('zinc','lead','copper'),155)

m=plotGoogleMaps(pies, zcol='pie')

pies$pie2=rep(1:3,155)
spplot(pies, 'pie2')

pies2<-pieSP(meuse,zcol=c('zinc','dist.m'), max.radius=70,scalelist=FALSE)
pies2$pie=rep(c('zinc','dist.m'),155)

m=plotGoogleMaps(pies2, zcol='pie')

# plotKML(pies, col='pie')

Run the code above in your browser using DataLab