Type: | Package |
Title: | A Spatial Data Visualization Tool |
Depends: | R (≥ 2.10.0) |
Suggests: | testthat |
Description: | You can call zm(), when displaying any active plot to enter an interactive session to zoom/navigate any plot. The development version, as well as binary releases can be found at https://github.com/cbarbu/R-package-zoom. |
License: | GPL (≥ 3) |
Encoding: | UTF-8 |
LazyLoad: | yes |
URL: | https://github.com/cbarbu/R-package-zoom |
Author: | Corentin M Barbu |
Maintainer: | Corentin M Barbu <corentin.barbu@gmail.com> |
Version: | 2.0.6 |
Date: | 2022-05-30 |
RoxygenNote: | 7.1.1 |
NeedsCompilation: | no |
Packaged: | 2022-05-31 08:26:15 UTC; cbarbu |
Repository: | CRAN |
Date/Publication: | 2022-05-31 14:10:02 UTC |
The zoom Package
Description
A spatial data visualization tool.
Details
Package: | zoom |
Type: | Package |
Version: | 2.0.6 |
Date: | 2014-03-18 |
Depends: | R (>= 2.10.0) |
Encoding: | UTF-8 |
License: | GPL (>= 3) |
LazyLoad: | yes |
URL: | https://github.com/cbarbu/R-package-zoom |
zm(), enters an interactive session to zoom and navigate the active plot. The development version, as well as binary releases can be found at https://github.com/cbarbu/R-package-zoom
Author(s)
Corentin M Barbu corentin.barbu@gmail.com, with contributions from Sebastian Gibb mail@sebastiangibb.de
Direct access to zoom functionalities.
Description
Direct selection of a zoom method of the "session" type. Possibly of use in scripts?
Usage
in.zoom(...)
move.to.click.zoom(...)
inout.zoom(...)
out.zoom(...)
set.zoom(...)
sq.zoom(...)
Arguments
... |
Extra arguments to zoomplot.zoom. |
Note
Each function starts a different interactive sequence
inout.zoom(): left click within bounds zooms in, outside bounds zoom out
move.to.click.zoom(): center plot arround left click
in.zoom(): each left click zooms in
out.zoom(): each left click zooms out
set.zoom(): ask for a magnification factor
sq.zoom(): allow to click on the two corners of the desired region to zoom on
Author(s)
Corentin M. Barbu
See Also
zm(), session.zoom().
Opening of an interactive zoom/navigate session.
Description
To launch an interactive session you should use zm() but if you are sure of your device you can launch directly one of these functions.
Usage
session.zoom(...)
navigation.zoom(...)
Arguments
... |
Everything that can be accepted by sq.zoom. |
Details
session.zoom launch an interactive console menu to navigate a plot.
navigation.zoom allows to interactively navigate a plot with the mouse.
Value
Returns the final plot, as saved by recordPlot().
Author(s)
Corentin M. Barbu, Sebastian Gibb
See Also
zm().
Examples
## Not run:
plot(rnorm(100),rnorm(100))
session.zoom()
## End(Not run)
Launch interaction on a plot
Description
Allow to zoom/navigate in any open plot. The controls should be intuitive:
zoom in: scroll up, or right click if no scrolling weel.
zoom out: scroll down, or Hold left + right click if no working weel.
move: left click and move
Usage
zm(type = "navigation", rp = NULL)
Arguments
type |
the type of interaction with the plot. Possible types are:
Or any short names for these. By default will try to launch a "navigation" session. |
rp |
plot to navigate, saved using |
Details
By default, zm() try to open a mouse interactive session. If the current
device is not interactive, will try to replot the current plot in a
X11(type="Xlib")
device. If it fails it will open a console menu
based interactive session.
Zoom handle multiple plots on a device together. You need to navigate the last one plotted and all the other plots will be navigated according to the last one: that can be pretty amazing too if you want to explore multiple layers at the same time.
Value
The recording of the final plot. Can be reploted using replayPlot().
The most useful may be to get the xlim and ylim of the final plot. That can
be simply got using: par("usr")
after zm()
ends.
Note
This function relies on pretty low level functions in R that change quite often with new versions. New version of R can break this package but I got used to it and fix it quickly.
In case you close the device before striking q, just hit Ctrl-C on the command line.
Author(s)
Corentin M. Barbu
Examples
## Not run:
# basic example
plot(rnorm(1000),rnorm(1000)) # could be any plot
zm() # navigate the plot
# use the same xlim/ylim as ended up in the zoom session
xylim<-par("usr") # xmin,xmax,ymin,ymax of the final version of the plot
dev.off()
plot(rnorm(1000),rnorm(1000),xlim=xylim[1:2],ylim=xylim[3:4])
# navigate two layers of data at the same time
par(mfrow=c(1,2))
plot(1,type="n",xlim=c(-3,3),ylim=c(-3,3),main="First Track")
polygon(c(-1,1,1,-1)*2,c(-1,-1,1,1)*2,col="blue")
lines(rnorm(100),rnorm(100))
plot(1,type="n",xlim=c(-3,3),ylim=c(-3,3),main="Second Track")
polygon(c(-1,1,1,-1)*2,c(-1,-1,1,1)*2,col="green")
lines(rnorm(100),rnorm(100))
zm() # it flickers quite a bit as it needs to replot everything every time...
# one might want to use the older interface
# if attached to cairo under linux or MacOS
# it is also sometimes helpful to just define a square you want to zoom on
zm(type="s")
## End(Not run)
Central low level function of the zoom package.
Description
This function allows to replot the current or a saved plot with specific boundaries, magnification factor and possibly arround a user defined x/y.
Usage
zoomplot.zoom(
xlim = NULL,
ylim = NULL,
fact = NULL,
moveX = NULL,
moveY = NULL,
rp = NULL,
x = NULL,
y = NULL,
xlimfn = NULL,
ylimfn = NULL,
...
)
Arguments
xlim |
A vector with min and max x |
ylim |
A vector with min and max y |
fact |
A scalar giving the magnification factor (>1 brings you closer) |
moveX |
Expected shift on X axis. |
moveY |
Expected shift on Y axis. corresponding warnings in ?recordPlot. |
rp |
A previously recorded plot with recordPlot(). With all the |
x |
x of a fix point when rescaling, by default the center. |
y |
y of a fix point when rescaling, by default the center. |
xlimfn |
a function using x, y and/or fact to generate new x lim if NULL and xlim/ylim not given will use multipancPoint |
ylimfn |
a function using x, y and/or fact to generate new y lim, if NULL will use xlimfn |
... |
Additional parameters not implemented, just in case. |
Details
This function is not necessarily easy to use by hand. It is designed to work well when called from higher level functions. End user should always use zm().
Value
Not guaranted for now.
Note
This function is the heart of the zoom package and the one that can be. affected by R version changes. It is inspired by the zoomplot function in TeachingDemos package
Author(s)
Corentin M. Barbu
See Also
zm, in.zoom
Examples
plot(rnorm(1000),rnorm(1000))
zoomplot.zoom(fact=2,x=0,y=0)