The R Project SVN R

Rev

Rev 39607 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
27442 ripley 1
\name{plot.window}
2
\alias{plot.window}
38888 ripley 3
\alias{asp}
4
\concept{aspect ratio}
27442 ripley 5
\title{Set up World Coordinates for Graphics Window}
6
\description{
7
  This function sets up the world coordinate system for a graphics
8
  window.  It is called by higher level functions such as
9
  \code{\link{plot.default}} (\emph{after} \code{\link{plot.new}}).
10
}
11
\usage{
12
plot.window(xlim, ylim, log = "", asp = NA, \dots)
13
}
14
\arguments{
39607 ripley 15
  \item{xlim, ylim}{numeric vectors of length 2, giving the x and y
16
    coordinates ranges.}
27442 ripley 17
  \item{log}{character; indicating which axes should be in log scale.}
18
  \item{asp}{numeric, giving the \bold{asp}ect ratio y/x.}
36209 ripley 19
  \item{\dots}{further graphical parameters as in \code{\link{par}}.
36235 ripley 20
    The relevant ones are \code{xaxs}, \code{yaxs} and \code{lab}.
36209 ripley 21
  }
27442 ripley 22
}
23
\details{
24
  Note that if \code{asp} is a finite positive value then the window is
25
  set up so that one data unit in the x direction is equal in length to
26
  \code{asp} \eqn{\times}{*} one data unit in the y direction.
27
 
28
  The special case \code{asp == 1} produces plots where distances
29
  between points are represented accurately on screen.  Values with
30
  \code{asp > 1} can be used to produce more accurate maps when using
31
  latitude and longitude.
32
 
39607 ripley 33
  To reverse an axis, use \code{xlim} or \code{ylim} of the form
34
  \code{c(hi, lo)}.
35
 
27601 ripley 36
  The function attempts to produce a plausible set of scales if one or
37
  both of \code{xlim} and \code{ylim} is of length one or the two values
38
  given are identical, but it is better to avoid that case.
39
 
27442 ripley 40
  Usually, one should rather use the higher level functions such as
41
  \code{\link{plot}}, \code{\link{hist}}, \code{\link{image}}, \dots,
42
  instead and refer to their help pages for explanation of the
43
  arguments.
36209 ripley 44
 
45
  A side-effect of the call is to set up the \code{usr}, \code{xaxp} and
46
  \code{yaxp} graphical parameters.  (It is for the latter two that
47
  \code{lab} is used.)
27442 ripley 48
}
49
\seealso{
50
  \code{\link{xy.coords}},
51
  \code{\link{plot.xy}},
52
  \code{\link{plot.default}}.
53
}
54
\examples{
55
##--- An example for the use of 'asp' :
30448 ripley 56
require(stats)  # normally loaded
27442 ripley 57
loc <- cmdscale(eurodist)
58
rx <- range(x <- loc[,1])
59
ry <- range(y <- -loc[,2])
60
plot(x, y, type="n", asp=1, xlab="", ylab="")
61
abline(h = pretty(rx, 10), v = pretty(ry, 10), col = "lightgray")
35849 ripley 62
text(x, y, labels(eurodist), cex=0.8)
27442 ripley 63
}
64
\keyword{aplot}