Learn R Programming

IDPmisc (version 0.3.1)

zoom: Zooming in and out in a 2d-Plot

Description

Function to zoom in and out in a 2D-plot.

Usage

zoom(fun = usa, zoom.col = "red", delay = 3, ...)

Arguments

fun
Plotting function
zoom.col
Color of clicked points
delay
Number of sec during which the 2nd zooming point is shown before zooming
...
Aditional arguments for plotting function

Details

When the clicked points lay within the plot region range, the points define the new plotting limits. When the clicked points lay in the margin, the plotting limits will be moved into the corresponding direction by 1/3 out of the actual range. There is no special sequential order for the zooming points required. The zooming function is stopped by right clicking and choosing the menu item "stop".

Examples

Run this code
x <- 1:100
y <- x*sin(x*(pi/16))
y <- c(rev(y),y)

if(dev.interactive())
   zoom(fun=plot, ty="l", x=y)

Run the code above in your browser using DataLab