18

I googled this to no avail. I must have unknowingly changed some setting because now when I print a plot or histogram rather than displaying the plot in the plots window, a new window opens with the plot. The title of the new window reads "R Graphics: Device 2 (ACTIVE)".

snarble
  • 325
  • 1
  • 3
  • 14

2 Answers2

5

It is a problem that appeared with R 3.3.0 for some RStudio versions. You can check your version with version in RStudio. It should work with a RSudio 0.99.902.

For more details, check here.

sjakw
  • 461
  • 4
  • 10
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/13237071) – MLavoie Aug 05 '16 at 11:42
  • I have edited the post to avoid the link-only answer effect. – sjakw Aug 05 '16 at 12:48
  • 2
    I've updated Rstudio from 0.99.457 to the newest version 0.99.903 and it fixed the issue, created by update to R 3.3.1 – JelenaČuklina Aug 17 '16 at 10:26
1

Some code you ran probably pushed a new graphics device onto the stack. You can turn it off with:

> dev.off()

See the R documentation for managing output devices.

Jonathan
  • 8,497
  • 41
  • 35
  • 3
    Thanks for the quick response Jonathan. I tried dev,off() and get the error message "Error in dev.off() : cannot shut down device 1 (the null device)". – snarble May 16 '16 at 22:20
  • 3
    And I get the following when I run the code from the link provided: > dev.off() Error in dev.off() : cannot shut down device 1 (the null device) > dev.cur() null device 1 > dev.list() NULL > dev.next(which = dev.cur()) null device 1 > dev.prev(which = dev.cur()) null device 1 > dev.off(which = dev.cur()) Error in dev.off(which = dev.cur()) : cannot shut down device 1 (the null device) > dev.set(which = dev.next()) null device 1 > dev.new(..., noRStudioGD = FALSE) Error: '...' used in an incorrect context > graphics.off() – snarble May 16 '16 at 22:21
  • For default device 1 cannot be closed. But if you have several devices open (e.g multiple graphics) you can choose with dev.off() which device will be closed. – Irbin B. Aug 30 '18 at 04:58