The R Project SVN R

Rev

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