[R] How to use a specifical graphical device (e.g., png, bmp) with R version 2.5.1under Linux

HU,ZHENGJUN
Mon, 22 Oct 2007 13:56:57 -0000

Hi All,

  I am now using R version 2.5.1 under Linux (Red Hat), and have
some problems to use some graphical devices (e.g., png, jpeg, bmp
and so on). Can you tell/teach me how to solve the problem(s)? See
below for details.

(1) I make sure that package:grDevices is on the list using
search(), for example:

> search()
[1] ".GlobalEnv"        "package:stats"
"package:graphics"
[4] "package:grDevices" "package:utils"
"package:datasets"
[7] "package:methods"   "Autoloads"
"package:base"

(2) I use png() and got the error:
> png()
Error in X11(paste("png::", filename, sep = ""), width,
height,
pointsize,  :
        unable to start device PNG
In addition: Warning message:
unable to open connection to X11 display '' in: png()

(3) I use X11() and obtained the error again
> X11()
Error in X11(display, width, height, pointsize, if
(is.null(gamma)) 1 else gamma,  :
        unable to start device X11
In addition: Warning message:
unable to open connection to X11 display '' in: X11()

  thank you very much for the help.
  Howard