plot.psp {spatstat.geom} | R Documentation |
plot a Spatial Line Segment Pattern
Description
Plot a two-dimensional line segment pattern
Usage
## S3 method for class 'psp'
plot(x, ..., main, add=FALSE,
show.all=!add, show.window=show.all, do.plot=TRUE,
use.marks=TRUE,
which.marks=1,
style=c("colour", "width", "none"),
col=NULL,
ribbon=show.all,
ribsep=0.15, ribwid=0.05, ribn=1024,
scale=NULL, adjust=1,
legend=TRUE,
leg.side=c("right", "left", "bottom", "top"),
leg.sep=0.1,
leg.wid=0.1,
leg.args=list(),
leg.scale=1,
negative.args=list(col=2))
Arguments
x |
The line segment pattern to be plotted.
An object of class |
... |
extra arguments that will be passed to the plotting functions
|
main |
Character string giving a title for the plot. |
add |
Logical. If |
show.all |
Logical value specifying whether to plot everything including the window, main title, and colour ribbon. |
show.window |
Logical value specifying whether to plot the window. |
do.plot |
Logical value indicating whether to actually perform the plot. |
use.marks |
Logical value specifying whether to use the marks
attached to the segments ( |
which.marks |
Index determining which column of marks to use,
if the marks of |
style |
Character string specifying how to represent the
mark value of each segment. If |
col |
Colour information.
If |
ribbon |
Logical value indicating whether to display a ribbon
showing the colour map (in which mark values are associated with
colours) when |
ribsep |
Factor controlling the space between the colour ribbon and the image. |
ribwid |
Factor controlling the width of the colour ribbon. |
ribn |
Number of different values to display in the colour ribbon. |
scale |
Optional. Physical scale for representing the mark values of
|
adjust |
Optional adjustment factor for |
legend |
Logical value indicating whether to display a legend
showing the width map (in which mark values are associated with
segment widths) when |
leg.side |
Character string (partially matched) specifying where the legend
should be plotted,
when |
leg.sep |
Factor controlling the space between the legend and the main plot,
when |
leg.wid |
Factor controlling the width of the legend,
when |
leg.args |
Optional list of additional arguments passed to
|
leg.scale |
Rescaling factor for labels, when |
negative.args |
Optional list of arguments to |
Details
This is the plot
method for
line segment pattern datasets (of class "psp"
,
see psp.object
).
It plots both the observation window Window(x)
and the line segments themselves.
Plotting of the window Window(x)
is performed by
plot.owin
. This plot may be modified
through the ...
arguments.
Plotting of the segments themselves is performed
by the standard R function segments
.
Its plotting behaviour may also be modified through the ...
arguments.
There are three different styles of plotting
which apply when the segments have marks
(i.e. when marks(x)
is not null):
style="colour"
(the default):-
Segments are plotted with different colours depending on their mark values. The colour map, associating mark values with colours, is determined by the argument
col
. The colour map will be displayed as a vertical colour ribbon to the right of the plot, ifribbon=TRUE
(the default). style="width"
:-
Segments are plotted with different widths depending on their mark values. The expanded segments are plotted using the base graphics function
polygon
. The width map, associating mark values with line widths, can be specified by giving the physical scale factorscale
. There is a sensible default scale, which can be adjusted using the adjustment factoradjust
. The width map will be displayed as a vertical stack of lines to the right of the plot, iflegend=TRUE
(the default). style="none"
oruse.marks=FALSE
:-
Mark information is ignored and the segments are plotted as thin lines using
segments
.
If marks(x)
is a data frame, the default is to use the first
column of marks(x)
to determine the colours or widths.
To specify another
column, use the argument which.marks
.
Value
If style="colour"
, the result is a colourmap
object specifying the association between
marks and colours, if any.
If style="width"
, the result is a numeric value giving the
scaling between the mark values and the physical widths.
In all cases, the return value also has an attribute
"bbox"
giving a bounding box for the plot.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au and Rolf Turner rolfturner@posteo.net
See Also
psp.object
,
plot
,
par
,
plot.owin
,
text.psp
,
symbols
Examples
X <- psp(runif(20), runif(20), runif(20), runif(20), window=owin())
plot(X)
plot(X, lwd=3)
lettuce <- sample(letters[1:4], 20, replace=TRUE)
marks(X) <- data.frame(A=1:20, B=factor(lettuce))
plot(X)
plot(X, which.marks="B")
plot(X, style="width", col="grey")