persp.ppp | R Documentation |
For a spatial point pattern with numeric marks, generate a perspective plot in which each data point is shown as a vertical spike, with height proportional to the mark value.
## S3 method for class 'ppp'
persp(x, ..., main, grid = TRUE, ngrid = 10,
col.grid = "grey", col.base = "white",
win.args=list(), spike.args = list(), neg.args = list(),
which.marks = 1, zlab = NULL, zlim = NULL, zadjust = 1)
x |
A spatial point pattern (object of class |
... |
Additional graphical arguments passed to
|
main |
Optional main title for the plot. |
grid |
Logical value specifying whether to draw a grid of reference lines on the horizontal plane. |
ngrid |
Number of grid lines to draw in each direction, if |
col.grid |
Colour of grid lines, if |
col.base |
Colour with which to fill the horizontal plane. |
win.args |
List of arguments passed to |
spike.args |
List of arguments passed to |
neg.args |
List of arguments passed to |
which.marks |
Integer, or character name, identifying the column of marks which
should be used, when |
zlab |
Optional. Label for the vertical axis. Character string or expression. |
zlim |
Optional. Range of values on the vertical axis. A numeric vector of length 2. |
zadjust |
Scale adjustment factor controlling the height of spikes. |
The function persp
is generic. This is the
method for spatial point patterns (objects of class "ppp"
).
The argument x
must be a point pattern with numeric marks,
or with a data frame of marks.
A perspective view will be plotted. The eye position is determined by
the arguments theta
and phi
passed to persp.default
.
First the horizontal plane is drawn in perspective view,
using a faint grid of lines to help suggest the perspective.
Next the observation window of x
is placed on the horizontal
plane and its edges are drawn in perspective view.
Finally for each data point in x
, a vertical spike is erected
at the spatial location of the data point, with height equal to the
mark value of the point.
If any mark values are negative, the corresponding spikes will
penetrate below the horizontal plane. They can be drawn in a different
colour by specifying neg.args
as shown in the examples.
Like all spatial plots in the spatstat family,
persp.ppp
does not independently rescale
the x
and y
coordinates. A long narrow window will be
represented as a long narrow window in the perspective view.
To override this and allow the coordinates to be independently
rescaled, use the argument scale=TRUE
which will be passed
to persp.default
.
(Invisibly) the perspective transformation matrix.
Adrian Baddeley.
persp(longleaf, theta=-30, phi=35, spike.args=list(lwd=3), zadjust=1.5)
# negative mark values
X <- longleaf
marks(X) <- marks(X) - 20
persp(X, theta=80, phi=35, neg.args=list(col="red"),
spike.args=list(lwd=3), zadjust=1.2)
# irregular window
Australia <- Window(austates)
Y <- runifrect(70, Frame(Australia))[Australia]
marks(Y) <- runif(npoints(Y))
persp(Y, theta=30, phi=20, col.base="lightblue",
win.args=list(col="pink", border=NA),
spike.args=list(lwd=2), zadjust=1.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.