# plot.fv

##### Plot Function Values

Plot method for the class `"fv"`

.

##### Usage

```
## S3 method for class 'fv':
plot(x, fmla, \dots, subset=NULL, lty=NULL, col=NULL, lwd=NULL,
xlim=NULL, ylim=NULL, xlab=NULL, ylab=NULL, ylim.covers=NULL,
legend=TRUE, legendpos="topleft", legendmath=FALSE,
shade=NULL, shadecol="grey")
```

##### Arguments

- x
- An object of class
`"fv"`

, containing the variables to be plotted or variables from which the plotting coordinates can be computed. - fmla
- an R language formula determining which variables or expressions are plotted. Either a formula object, or a string that can be parsed as a formula.
- subset
- (optional) subset of rows of the data frame that will be plotted.
- lty
- (optional) numeric vector of values of the graphical parameter
`lty`

controlling the line style of each plot. - col
- (optional) numeric vector of values of the graphical parameter
`col`

controlling the colour of each plot. - lwd
- (optional) numeric vector of values of the graphical parameter
`lwd`

controlling the line width of each plot. - xlim
- (optional) range of x axis
- ylim
- (optional) range of y axis
- xlab
- (optional) label for x axis
- ylab
- (optional) label for y axis
- ...
- Extra arguments passed to
`plot.default`

. - ylim.covers
- Optional vector of $y$ values that must be included in the
$y$ axis. For example
`ylim.covers=0`

will ensure that the $y$ axis includes the origin. - legend
- Logical flag or
`NULL`

. If`legend=TRUE`

, the algorithm plots a legend in the top left corner of the plot, explaining the meaning of the different line types and colours. - legendpos
- The position of the legend. Either a character string keyword
(see
`legend`

for keyword options) or a pair of coordinates in the format`list(x,y)`

. - legendmath
- Logical. If
`TRUE`

, the legend will display the mathematical notation for each curve. If`FALSE`

, the legend text is the identifier (column name) for each curve. - shade
- An index that identifies two columns of
`x`

. When the corresponding curves are plotted, the region between the curves will be shaded in light grey. Often used for displaying simulation envelopes, by setting`shade=c("hi",`

- shadecol
- The colour to be used in the
`shade`

plot. A character string or an integer specifying a colour.

##### Details

This is the `plot`

method for the class `"fv"`

.

The use of the argument `fmla`

is like `plot.formula`

, but offers
some extra functionality.
The left and right hand sides of `fmla`

are evaluated in the data frame `x`

,
and the results are plotted against each other
(the left side on the $y$ axis
against the right side on the $x$ axis).
Both left and right sides may be variables in the data frame
or expressions in these variables.

Multiple curves may be specified by a single formula
of the form
`cbind(y1,y2,...,yn) ~ x`

, where `x,y1,y2,...,yn`

are
expressions involving the variables in the data frame.
Each of the variables `y1,y2,...,yn`

in turn will be plotted
against `x`

.
See the examples.

A convenient abbreviation is the symbol `.`

which
can be used in the formula to represent all
the variables in the data frame (other than the function argument
itself). See the examples.

The value returned by this plot function indicates the meaning of the line types and colours in the plot. It can be used to make a suitable legend for the plot if you want to do this by hand. See the examples.

The argument `shade`

can be used to display critical bands
or confidence intervals. If it is not `NULL`

, then it should be
a subset index for the columns of `x`

, that identifies exactly
2 columns. When the corresponding curves are plotted, the region
between the curves will be shaded in light grey. See the Examples.

##### Value

- Either
`NULL`

, or a data frame giving the meaning of the different line types and colours.

##### See Also

##### Examples

```
data(cells)
K <- Kest(cells)
# K is an object of class "fv"
plot(K, iso ~ r) # plots iso against r
plot(K, sqrt(iso/pi) ~ r) # plots sqrt(iso/r) against r
plot(K, cbind(iso,theo) ~ r) # plots iso against r AND theo against r
plot(K, . ~ r) # plots all available estimates of K against r
plot(K, sqrt(./pi) ~ r) # plots all estimates of L-function
# L(r) = sqrt(K(r)/pi)
plot(K, cbind(iso,theo) ~ r, col=c(2,3))
# plots iso against r in colour 2
# and theo against r in colour 3
plot(K, iso ~ r, subset=quote(r < 0.2))
# plots iso against r for r < 10
# making a legend by hand
v <- plot(K, . ~ r, ylab="K(r)", legend=FALSE)
legend(0.05, 0.15, legend=v$meaning, lty=v$lty, col=v$col)
# significance bands
KE <- envelope(cells, Kest, nsim=19)
plot(KE, shade=c("hi", "lo"))
```

*Documentation reproduced from package spatstat, version 1.20-2, License: GPL (>= 2)*