Can't display png Can't display png r r

Can't display png


Does it help if you set option(bitmapType = 'cairo')? I have been skeptical about how R chooses the bitmap device type using .Call(C_cairoProps, 2L) in grDevices:::.onLoad() (this might be a bug, but I cannot say it for sure).

The option bitmapType falls back to Xlib if the test of cairo fails, thus giving you a cryptic error message about X11. Note the type argument in png():

> args(png)function (filename = "Rplot%03d.png", width = 480, height = 480,     units = "px", pointsize = 12, bg = "white", res = NA, ...,     type = c("cairo", "cairo-png", "Xlib", "quartz"), antialias) 

The default value of this argument is getOption('bitmapType'), and in your case it is Xlib due to the test in grDevices:::.onLoad(). If you are 100% sure that cairo works, you can change this option, say, in your ~/.Rprofile.


I was able to resolve this by installing a few additional development packages and then uninstalling/reinstalling R from source. All the other recommended options did not work for me until this.

sudo yum install pango-devel pango libpng-devel

Go to directory where source R file was installed:

make uninstall./configure --with-readline=no (or ./configure might work for you)makemake install