points.geodata | R Documentation |
This function produces a plot with points indicating the data locations. Arguments can control the points sizes, patterns and colors. These can be set to be proportional to data values, ranks or quantiles. Alternatively, points can be added to the current plot.
## S3 method for class 'geodata'
points(x, coords=x$coords, data=x$data, data.col = 1, borders,
pt.divide=c("data.proportional","rank.proportional",
"quintiles", "quartiles", "deciles", "equal"),
lambda = 1, trend = "cte", abs.residuals = FALSE,
weights.divide = "units.m", cex.min, cex.max, cex.var,
pch.seq, col.seq, add.to.plot = FALSE,
x.leg, y.leg = NULL, dig.leg = 2,
round.quantiles = FALSE, permute = FALSE, ...)
x |
a list containing elements |
coords |
an |
data |
a vector or matrix with data values.
If a matrix is provided each column is regarded as one variable or realization.
Defaults to |
data.col |
the number of the data column. Only used if
|
borders |
If an |
pt.divide |
defines the division of the points in categories.
See |
trend |
specifies the mean part of the model. The options are:
|
abs.residuals |
logical. If |
lambda |
value of the Box-Cox transformation parameter. Two particular cases
are |
weights.divide |
if a vector of weights with the same length as
the data is provided each data is
divided by the corresponding element in this vector.
Defaults divides the data by the element |
cex.min |
minimum value for the graphical parameter
|
cex.max |
maximum value for the graphical parameter
|
cex.var |
a numeric vector with the values of a variable defining the size of the points. Particularly useful for displaying 2 variables at once. |
pch.seq |
number(s) defining the graphical parameter |
col.seq |
number(s) defining the colors in the graphical parameter
|
add.to.plot |
logical. If |
x.leg , y.leg |
|
dig.leg |
the desired number of digits after the decimal
point. Printing values in the legend uses |
round.quantiles |
logical. Defines whether or not the values
of the quantiles should be rounded. Defaults to |
permute |
logical indication whether the data values should be
randomly re-alocatted to the coordinates. See |
... |
further arguments to be passed to the function
|
The points can be devided in categories and have different sizes
and/or colours according to the argument
pt.divide
. The options are:
sizes proportional to the data values.
sizes proportional to the rank of the data.
five different sizes according to the quintiles of the data.
four different sizes according to the quartiles of the data.
ten different sizes according to the deciles of the data.
all points with the same size.
defines a number of quantiles, the number provided defines the number of different points sizes and colors.
the values in the
vector will be used by the function cut
as break
points to divide the data in classes.
For cases where points have different sizes the arguments
cex.min
and cex.max
set the minimum and the maximum
point sizes. Additionally,
pch.seq
can set different patterns for the points and
col.seq
can be used to define colors.
For example, different colors
can be used for quartiles, quintiles and deciles while a sequence of
gray tones (or a color sequence) can be used
for point sizes proportional to the data or their ranks.
For more details see the section EXAMPLES
.
The argument cex.var
allows for displaying 2 variables
at once. In this case one variable defines the backgroung colour
of the points and the other defines the points size.
The argument permute
if set to TRUE
randomly realocates the data in the coordinates.
This may be used to
contrast the spatial pattern of original data against another
situation where there is no spatial dependence (when setting
permute = TRUE
). If a trend
is provided the residuals
(and not the original data) are permuted.
A plot is created or points are added to the current graphics device.
A list with graphical parameters used to produce the plot is returned invisibily.
According to the input options, the list has some or all of the
following components:
quantiles |
the values of the quantiles used to divide the data. |
cex |
the values of the graphics expansion parameter |
col |
the values of the graphics color parameter |
pch |
the values of the graphics pattern parameter |
Paulo J. Ribeiro Jr. paulojus@leg.ufpr.br,
Peter J. Diggle p.diggle@lancaster.ac.uk.
Further information on the package geoR can be found at:
http://www.leg.ufpr.br/geoR/.
plot.geodata
for another display of the data and
points
and plot
for information on the
generic R functions. The documentation of
par
provides details on graphical parameters.
For color schemes in R see gray
and
rainbow
.
op <- par(no.readonly = TRUE)
par(mfrow=c(2,2), mar=c(3,3,1,1), mgp = c(2,1,0))
points(s100, xlab="Coord X", ylab="Coord Y")
points(s100, xlab="Coord X", ylab="Coord Y", pt.divide="rank.prop")
points(s100, xlab="Coord X", ylab="Coord Y", cex.max=1.7,
col=gray(seq(1, 0.1, l=100)), pt.divide="equal")
points(s100, pt.divide="quintile", xlab="Coord X", ylab="Coord Y")
par(op)
points(ca20, pt.div='quartile', x.leg=4900, y.leg=5850)
par(mfrow=c(1,2), mar=c(3,3,1,1), mgp = c(2,1,0))
points(s100, main="Original data")
points(s100, permute=TRUE, main="Permuting locations")
## Now an example using 2 variable, 1 defining the
## gray scale and the other the points size
points.geodata(coords=camg[,1:2], data=camg[,3], col="gray",
cex.var=camg[,5])
points.geodata(coords=camg[,1:2], data=camg[,3], col="gray",
cex.var=camg[,5], pt.div="quint")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.