Note that there are some explanatory texts on larger screens.

plurals
  1. POggplot2 ggsave function causes graphics device to not display plots
    primarykey
    data
    text
    <p>I've updated my ggplot2 library and I am now having a problem where after calling ggsave, the graphics device no longer displays the plot. I'm unable to resolve the issue meaning I cannot export the plots as needed. Please help.</p> <p>Searching the web has revealed some mention of problems with dpi mismatches, but setting or changing the dpi appears to have no effect. This problem appears to have begun after doing an update of the ggplot2 library.</p> <p>The following code reproduces the problem:</p> <pre><code>library(ggplot2); df &lt;- read.table(textConnection('value,value1 1,1 2,2 3,3 '),header=TRUE,sep=','); ggplot(df,aes(x=value,y=value1)) + geom_point(); setwd('c:/temp'); ggsave('test.png'); </code></pre> <p>After running, the output is blank, and the graphics device no longer displays the plot. Any subsequent plots are not displayed on the graphics device.</p> <p>After running dev.off(), new plots are displayed okay, until ggsave is called again.</p> <p>sessionInfo() reports the versions of R and libraries as:</p> <pre><code>R version 3.0.0 (2013-04-03) Platform: i386-w64-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_New Zealand.1252 LC_CTYPE=English_New Zealand.1252 [3] LC_MONETARY=English_New Zealand.1252 LC_NUMERIC=C [5] LC_TIME=English_New Zealand.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] plyr_1.8 ggplot2_0.9.3.1 RODBC_1.3-6 loaded via a namespace (and not attached): [1] colorspace_1.2-2 dichromat_2.0-0 digest_0.6.3 grid_3.0.0 gtable_0.1.2 [6] labeling_0.1 MASS_7.3-26 munsell_0.4 proto_0.3-10 RColorBrewer_1.0-5 [11] reshape2_1.2.2 scales_0.2.3 stringr_0.6.2 tools_3.0.0 </code></pre> <p>The problem occurs in 2.15.0 and 2.15.3 of R also.</p> <p>EDIT: changed code so data would load using sep=',' rather than whitespace</p> <p>ADDITION: further testing reveals that this may in fact be a bug with RStudio and how it is displaying the graphics device after ggsave, rather than R itself. Running the above script in RGui does not reproduce the problem, only in RStudio V0.97.336 + V0.97.449.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload