Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 764
rlar Avatar asked Aug 02 '11 15:08

rlar


People also ask

How do I zoom in and out in R?

Zooming a Region The keyboard shortcut for zooming a pane is often the same as for moving to the pane, plus the Shift key. So, Ctrl+Shift+2 will zoom the Console; use the same sequence to un-zoom the Console and restore the prior layout.

How do you zoom in on a plot graph?

Method 1: Ctrl + Zoom to select region on graph and then copy layer. (on Tools toolbar docked at the left-hand side of the workspace). Press Ctrl key and drag out a rectangle area on the graph. It will create an enlarged graph.


1 Answers

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

like image 148
cmbarbu Avatar answered Oct 25 '22 04:10

cmbarbu