Learn R Programming

plotGoogleMaps (version 2.2)

PolyCol: Create list of colors depending on attribute data.

Description

The function provide list of colors, unique colors, levels of attribute,attribute breaks.

Usage

PolyCol(attribute, colPalette=NULL, at=NULL)

Arguments

attribute
vector of attribute data
colPalette
colours to be used to fill features depending on attribute
at
values at which colours will change

Value

See Also

plotGoogleMaps, ellipseGoogleMaps, bubbleGoogleMaps

Examples

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

m<-plotGoogleMaps(meuse,zcol='zinc')
# see results in your working directory

# similar classic plot
cols=PolyCol(meuse$zinc)$cols
plot(meuse,col=cols)

str(PolyCol(meuse$zinc))

m<-plotGoogleMaps(meuse,zcol='zinc',at=c(0,300,600, max(meuse$zinc)), colPalette=rainbow(3))
# similar classic plot
cols=PolyCol(meuse$zinc,colPalette=rainbow(3), at=c(0,300,600, max(meuse$zinc)) )$cols
plot(meuse,col=cols)

# plotKML(meuse, colour='zinc', colour_scale =cols)

Run the code above in your browser using DataLab