You could try with png2() in the R.devices package, which is just a convenient wrapper around the bitmap() device which can also produce PNGs. It's not perfect but it might get you going.
Henrik On Feb 1, 2018 08:24, "Sariya, Sanjeev" <ss5...@cumc.columbia.edu> wrote: > Thanks for your reply. I searched for the error on Google before resorting > to the R forum (help group). > I tried Sys.env(...) too, but didn't resolve the error I get. Hence I am > looking for solution. > > > > -- > > > -----Original Message----- > From: Thierry Onkelinx [mailto:thierry.onkel...@inbo.be] > Sent: Thursday, February 01, 2018 10:57 AM > To: Sariya, Sanjeev <ss5...@cumc.columbia.edu> > Cc: Jeff Newmiller <jdnew...@dcn.davis.ca.us>; r-help@r-project.org > Subject: Re: [R] Error while working with png output on linux server > > Dear Sanjeev, > > It seems that you system neither supports X11 devices nor cairo devices. > See http://lmgtfy.com/?q=R+unable+to+open+connection+to+X11 > for possible solutions. > > Best regards, > > ir. Thierry Onkelinx > Statisticus / Statistician > > Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN > BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & > Kwaliteitszorg / Team Biometrics & Quality Assurance > thierry.onkel...@inbo.be Havenlaan 88 bus 73, 1000 Brussel www.inbo.be > > //////////////////////////////////////////////////////////// > /////////////////////////////// > To call in the statistician after the experiment is done may be no more > than asking him to perform a post-mortem examination: he may be able to say > what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of > anecdote is not data. ~ Roger Brinner The combination of some data and an > aching desire for an answer does not ensure that a reasonable answer can be > extracted from a given body of data. ~ John Tukey > //////////////////////////////////////////////////////////// > /////////////////////////////// > > > > > 2018-02-01 16:18 GMT+01:00 Sariya, Sanjeev <ss5...@cumc.columbia.edu>: > > Thanks for pointing to FAQ: I tried with cairo (shared in commands), > unfortunately didn't work. > > > > -- > > Sanjeev Sariya > > > > > > -----Original Message----- > > From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] > > Sent: Thursday, February 01, 2018 10:12 AM > > To: r-help@r-project.org; Sariya, Sanjeev <ss5...@cumc.columbia.edu>; > > r-help@r-project.org > > Subject: Re: [R] Error while working with png output on linux server > > > > FAQ 7.19? > > > > Also, read the Posting Guide, in particular about posting using plain > text. > > -- > > Sent from my phone. Please excuse my brevity. > > > > On February 1, 2018 6:50:42 AM PST, "Sariya, Sanjeev" < > ss5...@cumc.columbia.edu> wrote: > >>I'm working on linux server: > >>Linux 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 > >>GNU/Linux > >> > >>I get error while creating png files. I'm sharing my commands and > >>error while I run those commands: > >> > >>>png("abc", type="cairo") > >>Error in .External2(C_X11, paste0("png::", filename), g$width, > >>g$height, : > >> unable to start device PNG > >>In addition: Warning message: > >>In png("abc", type = "cairo") : unable to open connection to X11 > >>display '' > >> > >>> png("apoeqqplot.png", res=600) > >>Error in .External2(C_X11, paste0("png::", filename), g$width, > >>g$height, : > >> unable to start device PNG > >>In addition: Warning message: > >>In png("apoeqqplot.png", res = 600) : > >> unable to open connection to X11 display '' > >> > >>dev.off() > >> > >>R version 3.4.2 (2017-09-28) > >>Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux > >>9 (stretch) > >> > >>Matrix products: default > >>BLAS: /mnt/mfs/cluster/bin/R-3.4/lib/libRblas.so > >>LAPACK: /mnt/mfs/cluster/bin/R-3.4/lib/libRlapack.so > >> > >>locale: > >>[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > >>[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > >>[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > >>[7] LC_PAPER=en_US.UTF-8 LC_NAME=C > >>[9] LC_ADDRESS=C LC_TELEPHONE=C > >>[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > >> > >>attached base packages: > >>[1] stats graphics grDevices utils datasets methods base > >> > >>other attached packages: > >>[1] CMplot_3.3.1 > >> > >>loaded via a namespace (and not attached): > >>[1] compiler_3.4.2 tools_3.4.2 > >> > >> > >>How do I fix this? > >> > >> > >> [[alternative HTML version deleted]] > >> > >>______________________________________________ > >>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > >>https://stat.ethz.ch/mailman/listinfo/r-help > >>PLEASE do read the posting guide > >>http://www.R-project.org/posting-guide.html > >>and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/ > posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.