colorGrinf: Generation of Customed Gradient Colors

Description Usage Arguments Value Examples

View source: R/colorGrinf.R

Description

This function is to generate the color gradient with the customed levels

Usage

1
colorGrinf(x, levels=NA, colors=c("green","yellow","red"), colsteps=10)

Arguments

x

A vector value

levels

levels of gradient colors

colors

Color ranges

colsteps

Levels of color gradient.

Value

levels

Level of values for legend use

cols

Color ranges for legeng use

index

Color values for map.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#Example

x=sample(c(1:1000),size=100)
x=x[order(x)]
ret=colorGrinf(x)


# A block Kriging example :

data("spointspre","countylayer")
tarF="d91" # target variable to be kriged
regionName="NAME_3"
bkRes=getTidBKMean(spointspre,countylayer,regionName,tarF,2)

bkRes=bkRes[!is.na(bkRes$bkm_fill),]
levels=c(30,60,100,150,250)
cr=colorGrinf(bkRes$bkm_fill,levels,colors=c("darkgreen","yellow","darkred"))
par(mar=c(1,1,1,1))
title=expression("Regional Block Kriged PM"[2.5]*" Concentration Estimated")
raster::plot(bkRes,col =cr$cols[cr$index],main=title)
legend("bottomright", fill =cr$cols, legend = cr$levels,col =cr$cols, cex=1,bty="n",bg="n")

lspatial/sptemUS documentation built on May 29, 2019, 3:42 a.m.