barnbmap: Bar plot of the number of neighbour and map

View source: R/barnbmap.r

barnbmapR Documentation

Bar plot of the number of neighbour and map

Description

The function barnbmap draws the bar plot of the link number distribution for a neighbourhood structure given by a nb object (spdep package) and links this bar plot with a map.

Usage

barnbmap(sf.obj, nb.obj, criteria = NULL, carte = NULL, identify = NULL, 
  cex.lab = 0.8, pch = 16, col = "lightblue3", xlab = "", ylab = "", 
  axes = FALSE, lablong = "", lablat = "")

Arguments

sf.obj

object of class sf

nb.obj

object of class nb

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 NULL, the name of the variable for identifying observations on the map

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)

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

######
# data on price indices of real estate in France
data(immob, package = "GeoXp")

# immob is a data.frame object. We have to create
# a Spatial object, by using first the longitude and latitude
require(sf)
immob.sf <- st_as_sf(immob, coords = c("longitude", "latitude"))
# optional : we add some contours that don't correspond to the spatial unit
# but are nice for mapping
midiP <- st_read(system.file("shapes/region.shp", package="GeoXp")[1])

# Spatial weight matrix based on nearest neighbours
immob.nb <- spdep::dnearneigh(st_coordinates(immob.sf), 0, 175000)

# a simple use of barnbmap
barnbmap(immob.sf, immob.nb, carte = midiP)

## Not run:  
# Data columbus
require("sf")
columbus <- sf::st_read(system.file("shapes/columbus.shp", package="spData")[1])
# col.gal.nb is a spatial weight matrix included in spdep package...
col.gal.nb <- spdep::read.gal(system.file("weights/columbus.gal", package="spData")[1])

barnbmap(columbus, col.gal.nb, criteria = (columbus$EW == 1),
   identify = "POLYID", cex.lab = 0.7)

## End(Not run)

tibo31/GeoXp documentation built on April 8, 2023, 7:50 a.m.