Learn R Programming

berryFunctions (version 1.9.0)

pointZoom: zoom in originally static x11 graphics

Description

zoom in x11 graphics - uses locator to define region to zoom into

Usage

pointZoom(x, y=NA, z=NA, Time=1, steps=30, las=1, usecolp=FALSE,
xlab=substitute(x), ylab=substitute(y), quiet=FALSE, expr, ...)

Arguments

x
same x coordinates as in current plot. x can be a matrix, then the y (and z) coordinates are taken from the second (and third) column.
y
ditto
z
if using colpoints, z-value
Time
Duration of zooming (speed) in seconds. DEFAULT: 1
steps
number of single zoomlevels. DEFAULT: 30
las
label axis style, see par. DEFAULT: 1
usecolp
logical: use colPoints when zooming? DEFAULT: FALSE
xlab
xlabel See plot. DEFAULT: substitute(x)
ylab
dito
quiet
logical. Should notifications (instructions) be written to the console? DEFAULT: FALSE
expr
Characterized Expression to be executed after each plot, eg. expr='abline(h=3)'
...
further arguments passed to plot or colPoints.

Value

  • none, works in existing graphics

See Also

shapeZoom in https://github.com/brry/shapeInteractive, colPoints, locator

Examples

Run this code
## Examples rely on locator, so can't be checked in non-interactive R use.
## Rcmd check --as-cran doesn't like to open external devices,
## so this example is excluded from running in the checks.
a <- rnorm(90); b <- rexp(90)
windows(record=TRUE) # turn recording on
plot(a,b, las=1)
pointZoom(a,b, col=2, expr="abline(v=0)")
# now scroll through the plots (Pg Up and Pg Dn) to unzoom again.

d <- data.frame(a,b)
class(d)
plot(d)
pointZoom(d)

Run the code above in your browser using DataLab