\HeaderA{plot.window}{Set up World Coordinates for Graphics Window}{plot.window}
\aliasA{asp}{plot.window}{asp}
\keyword{aplot}{plot.window}
\begin{Description}\relax
This function sets up the world coordinate system for a graphics
window.  It is called by higher level functions such as
\code{\LinkA{plot.default}{plot.default}} (\emph{after} \code{\LinkA{plot.new}{plot.new}}).
\end{Description}
\begin{Usage}
\begin{verbatim}
plot.window(xlim, ylim, log = "", asp = NA, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{xlim, ylim}] numeric vectors of length 2, giving the x and y
coordinates ranges.
\item[\code{log}] character; indicating which axes should be in log scale.
\item[\code{asp}] numeric, giving the \bold{asp}ect ratio y/x, see below.
\item[\code{...}] further graphical parameters as in \code{\LinkA{par}{par}}.
The relevant ones are \code{xaxs}, \code{yaxs} and \code{lab}.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\describe{
\item[asp:] If \code{asp} is a finite positive value then the window is
set up so that one data unit in the x direction is equal in length to
\code{asp} \eqn{\times}{*} one data unit in the y direction.

Note that in this case, \code{\LinkA{par}{par}("usr")} is no longer
determined by, e.g., \code{par("xaxs")}, but rather by \code{asp} and
the device's aspect ratio. (See what happens if you interactively
resize the plot device after running the example below!)

The special case \code{asp == 1} produces plots where distances
between points are represented accurately on screen.  Values with
\code{asp > 1} can be used to produce more accurate maps when using
latitude and longitude.
}

To reverse an axis, use \code{xlim} or \code{ylim} of the form
\code{c(hi, lo)}.

The function attempts to produce a plausible set of scales if one or
both of \code{xlim} and \code{ylim} is of length one or the two values
given are identical, but it is better to avoid that case.

Usually, one should rather use the higher level functions such as
\code{\LinkA{plot}{plot}}, \code{\LinkA{hist}{hist}}, \code{\LinkA{image}{image}}, \dots,
instead and refer to their help pages for explanation of the
arguments.

A side-effect of the call is to set up the \code{usr}, \code{xaxp} and
\code{yaxp} graphical parameters.  (It is for the latter two that
\code{lab} is used.)
\end{Details}
\begin{SeeAlso}\relax
\code{\LinkA{xy.coords}{xy.coords}},
\code{\LinkA{plot.xy}{plot.xy}},
\code{\LinkA{plot.default}{plot.default}}.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
##--- An example for the use of 'asp' :
require(stats)  # normally loaded
loc <- cmdscale(eurodist)
rx <- range(x <- loc[,1])
ry <- range(y <- -loc[,2])
plot(x, y, type="n", asp=1, xlab="", ylab="")
abline(h = pretty(rx, 10), v = pretty(ry, 10), col = "lightgray")
text(x, y, labels(eurodist), cex=0.8)
\end{ExampleCode}
\end{Examples}

