scattermap | R Documentation |
The function scattermap
draws a scatterplot of the given variables indicated
in names.var
and a map with sites
of coordinates coordinates(sf.obj)
. Boxplots of each variable
names.var[1]
and names.var[2]
are represented below the x-axis and y-axis.
scattermap(sf.obj, names.var, lin.reg = TRUE, quantiles = TRUE,
criteria = NULL, carte = NULL, identify = NULL,
cex.lab = 0.8, pch = 16, col = "lightblue3", xlab = "", ylab = "",
axes = FALSE, lablong = "", lablat = "")
sf.obj |
object of class sf |
names.var |
a vector of two characters : 1st name corresponds to the x-variable, 2nd name corresponds to the y-variable |
lin.reg |
If TRUE, drawing of the linear predictor for ‘response’ in linear model |
quantiles |
a boolean to represent the Additive Quantile Regression Smoothing |
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 histogram |
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 |
Each site is associated to a value of names.var[1]
and a value of
names.var[2]
. There is an interactivity between the two windows: the sites selected
by ‘point’ or ‘polygon’ on the scatterplot are represented on the map in red; sites selected
on the map are then represented in red on the scatterplot. Users have
the possibility to draw linear predictor for ‘response’ in linear model (option lin.reg
)
or conditionnal quantile regression spline (option quantiles
).
In the case where user click on save results
button,
a vector of integer is created as a global variable in last.select
object.
It corresponds to the number of spatial units selected just before leaving the Tk window.
Thomas-Agnan C., Aragon Y., Ruiz-Gazen A., Laurent T., Robidou L.
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.
dblehistomap
, histobarmap
, scattermap
, densitymap
######
# data on price indices of real estate in France
# 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])
# a example of use
scattermap(immob.sf, c("prix.vente", "prix.location"),
carte = midiP, xlab = "Average sell price", ylab = "Average rent price",
identify = "Nom", cex.lab = 0.6)
## Not run:
# data eire
eire <- sf::st_read(system.file("shapes/eire.shp", package="spData")[1])
# example of use of scattermap
scattermap(eire, c("ROADACC", "OWNCONS"), lin.reg = TRUE,
xlab = "Roads", ylab = "Consomation Rate", col = "purple")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.