Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RStudio suddenly stopped showing plots in the plot pane

Tags:

plot

r

rstudio

RStudio is not showing the generated plots in the plot pane anymore. Instead they open in a separate file with the name "Quartz". Here's my session info.:

> sessionInfo() R version 3.3.1 (2016-06-21) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.9.5 (Mavericks)  locale: [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8  attached base packages: [1] stats     graphics  grDevices utils     datasets  methods   base       other attached packages: [1] cluster_2.0.4 tm_0.6-2      NLP_0.1-9     ggplot2_2.1.0  loaded via a namespace (and not attached):  [1] colorspace_1.2-6 scales_0.4.0     plyr_1.8.4       parallel_3.3.1   tools_3.3.1      gtable_0.2.0     Rcpp_0.12.5      slam_0.1-35       [9] grid_3.3.1       munsell_0.4.3    

I tried tools > global options > panes > plots is selected.

I don't know what other info to share. I can see the plot pane with "plots" tab active. But it's blank.

Screen:

Notice the new menu with "Quartz" appear. Not sure what this is, but it comes up when R generates the plot and the usual RStudio menu disappears.

How do I get RStudio to display plots in the plots pane?

like image 386
Doug Fir Avatar asked Jun 28 '16 06:06

Doug Fir


People also ask

What does Dev OFF () do in R?

dev. off shuts down the specified (by default the current) device. If the current device is shut down and any other devices are open, the next open device is made current.

How do you clear the plot screen in R?

This is equivalent to click on the button clear all plots in the plots panel. This is identical to Ctrl+L or to click on the clear console within the Edit menu. This is equivalent to click on the button clear objects from the workspace in the environment panel.

What is the par function in R?

R par() function R programming has a lot of graphical parameters which control the way our graphs are displayed. The par() function helps us in setting or inquiring about these parameters. For example, you can look at all the parameters and their value by calling the function without any argument.


2 Answers

Try running this:

dev.off() 

Check if it works:

plot(rnorm(50), rnorm(50)) 
like image 152
mkearney Avatar answered Sep 20 '22 02:09

mkearney


I am working with Rmarkdown, and in my case I solved this problem like this:

  1. Go to Tools->Global Options->Rmarkdown

  2. In "Show output preview in" select "Viewer Pane"

  3. Uncheck the box "Show output inline for all R Markdown documents"

like image 39
Juan Avatar answered Sep 21 '22 02:09

Juan