[R-SIG-Mac] Intermittent plotting failures on new Quartz window
Chris Black
chris at ckblack.org
Thu May 5 20:43:38 CEST 2016
Hi, all. I’m getting some puzzling, intermittent plot failures that seem to occur only when I’m in an interactive session, arranging plots with very different drawing speeds, and only when Quartz needs to open a new window before plotting.
I posted a longer version of this at https://gist.github.com/infotroph/c68fc7a3f8594473361f87e2a348ddf9, but here’s a minimal example:
set.seed(34565)
library(ggplot2)
library(gridExtra)
library(grid)
p1 = ggplot(diamonds, aes(x, price))+geom_point()
p2 = ggplot(mtcars, aes(wt, mpg))+geom_point()
graphics.off()
pp=arrangeGrob(p1, p2)
grid.draw(pp)
Expected result: New graphics window containing a two-panel plot with diamonds on the top and cars on the bottom.
Observed result: Usually (~80% of the time?), a new graphics window with the top panel incompletely drawn (usually just axes with no points or panel grid), and the bottom panel as expected. Rarely (~20%?), the complete plot as expected.
I can modulate the success rate somewhat by putting different lengths of Sys.sleep() in between the arrangeGrob and grid.draw calls, and I can guarantee success by calling dev.new() before arrangeGrob. See the above-linked Gist for details and for session info from a few other folks — thus far only the Quartz users can reproduce it, hence my starting with this list.
Session info:
R for 3.2.4 GUI 1.67 Mavericks build (7152)
R version 3.2.4 (2016-03-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.3 (El Capitan)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] gridExtra_2.2.1 ggplot2_2.1.0
loaded via a namespace (and not attached):
[1] labeling_0.3 colorspace_1.2-6 scales_0.4.0 plyr_1.8.3
[5] tools_3.2.4 gtable_0.2.0 Rcpp_0.12.4 munsell_0.4.3
More information about the R-SIG-Mac
mailing list