SmoothLegend: Plots Smoothing Maps and a Legend

Description Usage Arguments Details Author(s) References Examples

View source: R/SmoothLegend.R

Description

Plots smoothing maps and legend based on continuous or percentile scale.

Usage

1
2
3
4
5
6
SmoothLegend(X, Y, z, resol = 200, type = "percentile", whichcol = "gray",
qutiles = c(0, 0.05, 0.25, 0.5, 0.75, 0.9, 0.95, 1), borders=NULL, leg.xpos.min = 780000,
leg.xpos.max = 8e+05, leg.ypos.min = 7760000, leg.ypos.max = 7870000,
leg.title = "mg/kg", leg.title.cex = 0.7, leg.numb.cex = 0.7, leg.round = 2,
leg.wid = 4, leg.numb.xshift = 70000, leg.perc.xshift = 40000,
leg.perc.yshift = 20000, tit.xshift = 35000)

Arguments

X

X-coordinates

Y

Y-coordinates

z

values on the coordinates

resol

resolution of smoothing

type

"percentile" for percentile legend; "contin" for continuous grey-scale or colour map

whichcol

type of color scheme to use: "grey", "rainbow", "rainbow.trunc", "rainbow.inv", "terrain" or "topo"

qutiles

considered quantiles if type="percentile" is used

borders

either NULL or character string with the name of the list with list elements x and y for x- and y-coordinates of map borders

leg.xpos.min

minimum value of x-position of the legend

leg.xpos.max

maximum value of x-position of the legend

leg.ypos.min

minimum value of y-position of the legend

leg.ypos.max

maximum value of y-position of the legend

leg.title

title for legend

leg.title.cex

cex for legend title

leg.numb.cex

cex for legend numbers

leg.round

round legend to specified digits "pretty"

leg.wid

width (space in numbers) for legend

leg.numb.xshift

x-shift of numbers in legend relative to leg.xpos.max

leg.perc.xshift

x-shift of "Percentile" in legend relative to leg.xpos.min

leg.perc.yshift

y-shift of "Percentile" in legend relative to leg.ypos.max

tit.xshift

x-shift of title in legend relative to leg.xpos.max

Details

First a interpolation is applied using different versions of algorithms from Akima and then all points a distinguished into inside an outside the polygonal region. Now the empirical quantiles for points inside the polygon are computed and then the values are plotted in different scales of the choosen colour. ATTENTION: here borders were defined for the smoothing region

Author(s)

Peter Filzmoser <P.Filzmoser@tuwien.ac.at> http://cstat.tuwien.ac.at/filz/

References

C. Reimann, P. Filzmoser, R.G. Garrett, and R. Dutter: Statistical Data Analysis Explained. Applied Environmental Statistics with R. John Wiley and Sons, Chichester, 2008.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(chorizon)
X=chorizon[,"XCOO"]
Y=chorizon[,"YCOO"]
el=log10(chorizon[,"As"])

# generate plot 
plot(X,Y,frame.plot=FALSE,xaxt="n",yaxt="n",xlab="",ylab="",type="n")

data(bordersKola) # list with list elements x and y for x- and y-corrdinates of map borders
SmoothLegend(X,Y,el,resol=200,type="contin",whichcol="gray",
    qutiles=c(0,0.05,0.25,0.50,0.75,0.90,0.95,1), borders="bordersKola",
    leg.xpos.min=7.8e5,leg.xpos.max=8.0e5,leg.ypos.min=77.6e5,leg.ypos.max=78.7e5,
    leg.title="mg/kg", leg.title.cex=0.7, leg.numb.cex=0.7, leg.round=2,leg.wid=4,
    leg.numb.xshift=0.7e5,leg.perc.xshift=0.4e5,leg.perc.yshift=0.2e5,tit.xshift=0.35e5)

# plot background
data(kola.background)
plotbg(map.col=c("gray","gray","gray","gray"),map.lwd=c(1,1,1,1),add.plot=TRUE)

Example output

Loading required package: geoR
--------------------------------------------------------------
 Analysis of Geostatistical Data
 For an Introduction to geoR go to http://www.leg.ufpr.br/geoR
 geoR version 1.7-5.2.1 (built on 2016-05-02) is now loaded
--------------------------------------------------------------

Loading required package: sgeostat
Warning messages:
1: no DISPLAY variable so Tk is not available 
2: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
3: 'rgl_init' failed, running with rgl.useNULL = TRUE 
4: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 

StatDA documentation built on March 13, 2020, 2:42 a.m.

Related to SmoothLegend in StatDA...