Learn R Programming

sitar (version 1.4.0)

xaxsd: Par args xaxs and yaxs option d

Description

Implements par('xaxs') and par('yaxs') option 'd'.

Usage

xaxsd(usr = par()$usr[1:2])

yaxsd(usr = par()$usr[3:4])

Value

By default returns xlim/ylim args to match current setting of par()$usr, i.e. previous plot scales. Specifying usr gives scales with the usr args at the extremes. If par('xlog') or par('ylog') are set the returned limits are antilogged (to base 10).

Arguments

usr

a length-2 vector defining the length of the x-axis or y-axis.

Author

Tim Cole tim.cole@ucl.ac.uk

Details

Implements par('xaxs') and par('yaxs') option 'd', i.e. uses previous axis scales in a new plot.

Examples

Run this code

## generate and plot 100 data points
x <- rnorm(100)
y <- rnorm(100)
plot(x, y, pch=19)

## generate and plot 10 more
## constraining axis scales to be as before
x <- rnorm(10)
y <- rnorm(10)
plot(x, y, pch=19, xlim=xaxsd(), ylim=yaxsd())

## force axis extremes to be -3 and 3
plot(x, y, pch=19, xlim=xaxsd(c(-3,3)), ylim=yaxsd(c(-3,3)))

Run the code above in your browser using DataLab