Create list of colors depending on attribute data.

Share:

Description

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

Usage

1
2
3
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

The function provide list of colors (cols), unique colors (col.uniq), levels of attribute (att),attribute breaks (brks).

Author(s)

Milan Kilibarda kili@grf.bg.ac.rs

See Also

plotGoogleMaps, ellipseGoogleMaps, bubbleGoogleMaps

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# 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)