How to Pop Up the Graphics Window from Rscript

How to plot in RStudio and not have a new window pop up (R Graphics: Device (ACTIVE)?

For others who like me may still encounter this issue:

This is probably caused by an R update to 3.3.2 and is fixed by installing a newer version of RStudio. In my case 1.0.136 did the trick.

Make R Studio plots only show up in new window

The dev.new() function will open a new plot window, which then becomes the target for all plots.

If you wish to open another window you can run the command a second time to open a second window.

dev.off() will shut down the window (in the order they were opened by default).

You can see how to control multiple graphics devices in the documentation here.

Leaving RScript-produced plots on screen until user interaction

This works for me on Linux:

#!/usr/bin/env Rscript

X11()
with(mtcars, plot(mpg, hp))
locator(1)

The user has to click the plot window before it disappears. I presume it would work on Windows with a call to windows() instead.

show multiple R graphics windows in (r)gedit

Not a gedit issue but a general R feature -- use x11() (or windows()) to create new plot devices.

You can then use dev.set() et al to flip between them.



Related Topics



Leave a reply



Submit