conspire

0th

Percentile

Plot Together According to a Formula

Given a data frame and a formula involving variables in the data frame, plot the left hand side of the formula versus the right hand side.

Keywords
spatial
Usage
conspire(indata, formula, subset=NULL, lty=NULL, col=NULL, xlim, ylim,
xlab, ylab)
Arguments
indata
A data frame, containing the variables to be plotted or variables from which the plotting coordinates can be computed.
formula
an S language formula determining which variables or expressions are plotted.
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.
xlim
(optional) range of x axis
ylim
(optional) range of y axis
xlab
(optional) label for x axis
ylab
(optional) label for y axis
Details

This function is like plot.formula but offers some extra functionality. The left and right hand sides of the formula argument are evaluated in the data frame indata, 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.

Value

  • none. Side effect is a plot.

Aliases
  • conspire
Examples
library(spatstat)

   df <- data.frame(x=1:20, y=sqrt(1:20), z = sqrt(1:20) + runif(20))

   conspire(df, y ~ x)             # plots y against x

   conspire(df, log(y) ~ log(x))   # plots log(y) against log(x)

   conspire(df, z - sqrt(x) ~ x)   # plots z - sqrt(x) against x


   conspire(df, cbind(y,z) ~ x)   # plots y against x  AND z against x

   conspire(df, cbind(z,sqrt(x)) ~ x)
                                  # plots z against x  AND sqrt(x) against x

   conspire(df, cbind(z - sqrt(x),0) ~ x)
                                   # plots z - sqrt(x) against x
                                   # with dashed horizontal line at height 0

   conspire(df, cbind(y,z) ~ x, col=c(2,3))
                                   # plots y against x  in colour 2
                                   # and z against x in colour 3

   conspire(df, y ~ x, subset=quote(x < 10))
                                   # plots y against x for x < 10
Documentation reproduced from package spatstat, version 1.2-1, License: GPL version 2 or newer

Community examples

Looks like there are no examples yet.