Re: [R] [Rd] An issue happens Embed R and redirt png file

From: Rongrong <dna_jin_at_hotmail.com>
Date: Wed, 04 Jun 2008 22:32:26 -0700 (PDT)

My R version is R 2.7.0, but the png still can not be used when I embed R in MyApp

Dirk Eddelbuettel wrote:
>
>
>
> Wrong list, so re-directing to r-help. Consider r-sig-debian for Debian
> questions too, but subscribe or else your posts bounce.
>
> On 4 June 2008 at 07:18, Rongrong wrote:
> |
> | I am a new R user and I have a question of embedding R to generate png
> | On Debian, I installed R by source code.
> |
> | Now I want to embed R in an application which name is MyApp, and run
> | the following syntax:
> | png(filename="/tmp/Rplot%03d.png)
> | example(rect)
> | dev.off()
> |
> | Unfortunately I get the following error message:
> |
> | Error in X11(paste("png::", filename, sep = ""), width, height,
> pointsize,
> | :
> | unable to start device PNG
> | Calls: png
> | In addition: Warning message:
> | In png(filename = "/tmp/test%03d.png") :
> | unable to open connection to X11 display ''
>
> See the R FAQ.
>
> | But I could run above syntax from R, and the result is correct, I can
> get
> | two png files from /tmp/ folder.
> |
> | I try to respectively run same syntax(the syntax is:
> | capabilities()[["png"]])
> | under two modes, the result is different:
> | In R the result is TRUE, but when MyApp embed R the result is FALSE
>
> Because in case you have an x11 display, and in the other your don't. No
> display, no x11.
>
> | Then I used bitmap(file="/tmp/test") when embed R in MyApp, but get
> another
> | error message:
> |
> | Error in bitmap(file = "/tmp/test") : sorry, 'gs' cannot be found
>
> Fix that via
> $ sudo apt-get install ghostscript
>
> | Besides, I have installed xvfb. What I need do?
>
> Almost there. Wrap your call to MyApp in svfb-run, ie do
>
> $ xvfb-run MyApp [other parameters]
>
> and you get the virtual x11 device that png needs.
>
> R 2.7.0 should also alleviate the need for an x11 device due to its new
> cairo-based device code. While you didn't tell as which R version you are
> running, I suspect it is not the one the current one.
>
> Dirk
>
> --
> Three out of two people have difficulties with fractions.
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> 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.
>
>

-- 
View this message in context: http://www.nabble.com/Re%3A--Rd---An-issue-happens-Embed-R-and-redirt-png-file-tp17653928p17662473.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
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.
Received on Thu 05 Jun 2008 - 06:54:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 05 Jun 2008 - 12:30:36 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive