I am running 64-bit R 2.15.0 on a Windows Server 2008 R2 Amazon EC2 instance. grid
does not produce output. For example, the following code should produce a single diagonal line in a device window:
grid.newpage()
l <- linesGrob()
grid.draw(l)
I, however, see nothing. Is there a flag or option I should be using on Windows Server 2008 R2 to enable grid output?
EDIT: Another reproducible example that works on my home (Windows 7 x64) and work PCs (Windows XP):
library(grid)
library(png)
img.path <- system.file("img", "Rlogo.png", package="png")
bg <- readPNG(img.path)
background <- rasterGrob(unclass(bg))
grid.draw(background)
This is the expected output, as seen on my work PC (resized to fit below):
dev.list()
can be called to return a named vector of open graphics devices. On Windows, for example:And
dev.cur()
will return the currently active device. If there are no devices open, you can open one:For pdf, you have to be sure to close the device or else the pdf file will not render:
The
?device
help page lists the other graphics devices. Usually a call togrid.newpage()
automatically opens a new device if none are open, but perhaps not in your case. The above examples work for me on Windows 7 x64 and Ubuntu 11.10 x64.@attitude_stool: Does any of the above help identify your problem?
R
does not produce raster images correctly in the window device over Remote Desktop Connection. If a raster image is required, the plot must be output to another device.I have found that writing plotting commands between the
pdf()
anddev.off()
produces blank files. Storing the plot in an object and calling it will work.