histnbmap: Interactive histogram of the distances between two neighbors...

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/histnbmap.r

Description

The function histnbmap() draws the histogram of the distances between two neighbors for a neighbourhood structure given by a nb object and calculated by nbdists function (see spdep package), and links the graphic with a map.

Usage

1
2
3
4
histnbmap(sp.obj, nb.obj, longlat = NULL, nbcol=10, 
type = c("count","percent", "density"), sup=FALSE, criteria=NULL, carte=NULL, 
identify=FALSE, cex.lab=0.8, pch=16, col="lightblue3", xlab="", ylab="count", 
axes=FALSE, lablong="", lablat="")

Arguments

sp.obj

object of class extending Spatial-class

nb.obj

object of class nb

longlat

TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in kilometers; if coords is a SpatialPoints object, the value is taken from the object itself

nbcol

number of cells for histogram (10 by default)

type

Character string indicating type of histogram to be drawn. "percent" and "count" give relative frequency and frequency histograms, "density" produces a density scale histogram.

sup

if TRUE, it keeps only the distance of the neighbor the farest

criteria

a vector of boolean of size the number of Spatial units, which permit to represent preselected sites with a cross, using the tcltk window

carte

matrix with 2 columns for drawing spatial polygonal contours : x and y coordinates of the vertices of the polygon

identify

if not FALSE, identify plotted objects (currently only working for points plots). Labels for identification are the row.names of the attribute table row.names(as.data.frame(sp.obj)).

cex.lab

character size of label

pch

16 by default, symbol for selected points

col

"lightblue3" by default, color of bars on the barplot

xlab

a title for the graphic x-axis

ylab

a title for the graphic y-axis

axes

a boolean with TRUE for drawing axes on the map

lablong

name of the x-axis that will be printed on the map

lablat

name of the y-axis that will be printed on the map

Details

For a selected site j on the map, are represented on the map its neighbours. For a selected bar on the graph, the corresponding sites are represented on the map with a link which means that two sites are neighbours.

Value

No value returned.

Note

When user select sites on the graph or on the map, he cannot add a selection by using the other graphic.

Author(s)

Aragon Y., Thomas-Agnan C., Ruiz-Gazen A., Laurent T.

References

Thibault Laurent, Anne Ruiz-Gazen, Christine Thomas-Agnan (2012), GeoXp: An R Package for Exploratory Spatial Data Analysis. Journal of Statistical Software, 47(2), 1-23.

Roger S.Bivand, Edzer J.Pebesma, Virgilio Gomez-Rubio (2009), Applied Spatial Data Analysis with R, Springer.

See Also

moranplotmap,makeneighborsw,normw,nonormmoran

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
##
# data columbus
require("maptools")
example(columbus)

# a simple use of histnbmap
histnbmap(columbus, col.gal.nb, criteria=(columbus$CP==1),
xlab="distance of the neighbor the farest")

##
# data meuse
data(meuse)

# meuse is a data.frame object. We have to create
# a Spatial object, by using first the longitude and latitude
# to create Spatial Points object ...
meuse.sp = SpatialPoints(cbind(meuse$x,meuse$y))
# ... and then by integrating other variables to create SpatialPointsDataFrame
meuse.spdf = SpatialPointsDataFrame(meuse.sp, meuse)

# meuse.riv is used for contour plot
data(meuse.riv)

# creation of a spatial weight matrix (class nb) based
# on the Delaunay triangulation
meuse.nb <- tri2nb(coordinates(meuse.sp))

# a example with some optionswhich shows the limit of
# this kind of spatial weight matrix
histnbmap(meuse.spdf, meuse.nb, sup=TRUE, nbcol=7,
carte=meuse.riv[c(21:65,110:153),])

GeoXp documentation built on May 29, 2017, 11:25 a.m.