This function sets up the world coordinate system for a graphics
window. It is called by higher level functions such as
numeric vectors of length 2, giving the x and y coordinates ranges.
character; indicating which axes should be in log scale.
numeric, giving the aspect ratio y/x, see ‘Details’.
further graphical parameters as in
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
asp * one data unit in the y direction.
Note that in this case,
par("usr") is no longer
determined by, e.g.,
par("xaxs"), but rather by
the device's aspect ratio. (See what happens if you interactively
resize the plot device after running the example below!)
The special case
asp == 1 produces plots where distances
between points are represented accurately on screen. Values with
asp > 1 can be used to produce more accurate maps when using
latitude and longitude.
Note that the coordinate ranges will be extended by 4% if the
appropriate graphical parameter
yaxs has value
"r" (which is the default).
To reverse an axis, use
ylim of the form
The function attempts to produce a plausible set of scales if one or
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
instead and refer to their help pages for explanation of the
A side-effect of the call is to set up the
yaxp graphical parameters. (It is for the latter two that
lab is used.)
par for the graphical parameters mentioned.
1 2 3 4 5 6 7 8
##--- 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.