Learn R Programming

geoR (version 1.2-5)

points.geodata: Plots Spatial Locations and Data Values

Description

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.

Usage

points.geodata(x, coords=x$coords, data=x$data, data.col = 1, borders = NULL,
               pt.divide=c("data.proportional","rank.proportional",
                           "quintiles", "quartiles", "deciles", "equal"),
               lambda = 1, trend = "cte", weights.divide = NULL, cex.min,
               cex.max, pch.seq, col.seq, add.to.plot = FALSE,
               round.quantiles = FALSE, graph.pars = FALSE, ...)

Arguments

x
a list containing elements coords and data described next. Typically an object of the class "geodata" - a geoR data-set. If not provided the arguments coords and data must
coords
an $n \times 2$ matrix containing coordinates of the $n$ data locations in each row. Defaults to geodata$coords.
data
a vector or matrix with data values. If a matrix is provided each column is regarded as one variable or realization. Defaults to geodata$data.
data.col
the number of the data column. Only used if data is a matrix with columns corresponding to different variables or simulations.
borders
If an $n \times 2$ matrix or data-frame with the coordinates of the borders of the regions is provided, the borders are added to the plot.
pt.divide
defines the division of the points in categories. See DETAILS below for the available options. Defaults to pt.divide = "data.proportional".
trend
specifies the mean part of the model. The options are: "cte" (constant mean - default option), "1st" (a first degree polynomial on the coordinates), "2nd" (a second degree polynomial on the coordinates),
lambda
value of the Box-Cox transformation parameter. Two particular cases are $\lambda = 1$ which corresponds to no transformation and $\lambda = 0$ corresponding to the log-transformation.
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 to NULL.
cex.min
minimum value for the graphical parameter cex. This value defines the size of the point corresponding the minimum of the data. Defaults to 0.5.
cex.max
maximum value for the graphical parameter cex. This value defines the size of the point corresponding the maximum of the data. If pt.divide = "equal" it is used to set the value for the graphical parameter c
pch.seq
number(s) defining the graphical parameter pch.
col.seq
number(s) defining the colors in the graphical parameter col.
add.to.plot
logical. If TRUE the points are added to the current plot otherwise a new plot is created. Defaults to FALSE.
round.quantiles
logical. Defines whether or not the values of the quantiles should be rounded. Defaults to FALSE.
graph.pars
logical. If TRUE the graphics parameters used to produce the plots are returned. Defaults to FALSE.
...
further arguments to be passed to the function plot, if add.to.plot = FALSE; or to the function points, if add.to.plot = TRUE.

Value

  • A plot is created or points are added to the current graphics device. By default no value is returned. However, if graph.pars = TRUE a list with graphical parameters used to produce the plot is returned. According to the input options, the list has some or all of the following components:
  • quantilesthe values of the quantiles used to divide the data.
  • cexthe values of the graphics expansion parameter cex.
  • colthe values of the graphics color parameter col.
  • pchthe values of the graphics pattern parameter pch.

Details

The points can be devided in categories and have different sizes and/or colours according to the argument pt.divide. The options are: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

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.

References

Further information about geoR can be found at: http://www.maths.lancs.ac.uk/~ribeiro/geoR.

See Also

plot.geodata for another display of the data and points and plot for information on the generic Rfunctions. The documentation of par provides details on graphical parameters. For color schemes in Rsee gray and rainbow.

Examples

Run this code
if(is.R()) data(s100)
op <- par(no.readonly = TRUE)
par(mfrow=c(2,2))
par(mar=c(3,3,1,1))
par(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")
               # the function gray() works only for R
points(s100, pt.divide="quintile", xlab="Coord X",
               ylab="Coord Y")
par(op)

Run the code above in your browser using DataLab