Can I navigate, zoom in and zoom out R plots?

rlar picture rlar · Aug 2, 2011 · Viewed 49.4k times · Source

I would like to know if R allows to pan and zoom images produced with the "plot" function. I would like to obtain the plot transformation using the mouse and not through the command line, is it possible?

Thanks in advance.

Answer

cmbarbu picture cmbarbu · Sep 6, 2013

It's a bit old question but for future references, I've wrote a package doing precisely that (based on zoomplot {in pkg:TeachingDemos}). It's called zoom:

The CRAN page on zoom

And you are welcome to check the latest and greatest and expand the package on Github

Usage -

library(zoom) # Invoke the Library
# Call plot
zm()

The instructions for Usage in a normal plot is

Mouse:

  • Scroll to zoom in and out
  • Hold left mouse button to move

Keyboard:

  • Left/Right (h/l): move left/right
  • Up/Down (k/j) : move up/down
  • + or i / - or o : zoom in/out
  • L/H : zoom in/out (x-axis only)
  • K/J : zoom in/out (y-axis only)
  • p : print to file
  • r : reset limits
  • s : show limits

q on the graphic window to quit