问题
Instead they open in a separate file with the name "Quartz"
> 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 dissappears.
How do I tell rstudio to display plots in the plots pane, like it was doing 5 minutes ago?
回答1:
Try running this.
dev.off()
See if it works
plot(rnorm(50), rnorm(50))
回答2:
I am working with Rmarkdown, and in my case I solved this problem like this:
Go to Tools->Global Options->Rmarkdown
In "Show output preview in" select "Viewer Pane"
Uncheck the box "Show output inline for all R Markdown documents"
All the best!
回答3:
for me, it worked when I first closed all the devices @udit-gupta. Recursively closing all the devices after finding the devices.
dev.cur()
dev.off(i) #where i = index of device to be switched off
get the device back with
getOption("device")
or
dev.set(which = dev.next())
回答4:
Follow below procedure to resolve the issue.
dev.off()
print(plot(1)) # Basically use print command once
now use plot command as you normally use and should work fine.
回答5:
I had the same problem after updating R to version 3.3.2 and using Rstudio 0.98.0. Installing the latest version of RStudio fixed the problem
回答6:
Had the same problem ... was able to visualize plots in the plot pane for a while before it vanished ... all the attempts with the suggestions above failed ... referred the below blog and got it working ...
https://datasciencelearner.wordpress.com/2014/08/17/my-plot-is-not-showing-up/
the trick is to wrap the graphics command inside print function ... for instance ...
print(
plt2 <- ggplot(housing,
aes(x = Home.Value)) +
geom_histogram()
)
回答7:
It could be because graphic device are already on .
To find indices of open devices:
dev.cur()
to close devices
dev.off(i)
whereas i = index of device to be switched off
来源:https://stackoverflow.com/questions/38068774/rstudio-suddenly-stopped-showing-plots-in-in-plot-pane