简体   繁体   中英

Rstudio server cannot create plot

I installed R on a cluster, and I use Rstudio server to edit my R programs. The rstudio-server is operating over a browser.

Everything's working fine, except the 'plot'.

I tried to plot, for example using the R sample data:

plot(cars)

it will return:

24 Jul 2014 15:58:37 [rsession-ubuntu] ERROR r error 4 (R code execution error) [errormsg=Error in grDevices:::png("/tmp/RtmpWjMGwA/6bca9fa4842a42418ab83d2c0ef7453b.png",  : 
  X11 is not available
]; OCCURRED AT: core::Error r::exec::evaluateString(const std::string&, SEXPREC**, r::sexp::Protect*) /home/ubuntu/rstudio/src/cpp/r/RExec.cpp:266; LOGGED FROM: DevDesc* r::session::graphics::handler::shadow::<unnamed>::shadowDevDesc(DevDesc*) /home/ubuntu/rstudio/src/cpp/r/session/graphics/RShadowPngGraphicsHandler.cpp:141
Error in RStudioGD() : 
  Shadow graphics device error: r error 4 (R code execution error)

Capabilities shows:

> capabilities()
 jpeg      png     tiff    tcltk      X11     aqua http/ftp  sockets   libxml     fifo   cledit    iconv      NLS  profmem    cairo 
FALSE    FALSE    FALSE    FALSE    FALSE    FALSE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE     TRUE    FALSE    FALSE 

Does any one ever create a plot using rstudio-server? Please help! Thank you!


update

I modify the title a little. Because I found that it doesn't seem like an Rstudio server issue alone. I reinstalled R with "--with-x=yes". (I previously installed R using "--with-x=no" to avoid the "X11 header/libs error" issue.)

Now the ERROR changed to:

Error in .External2(C_X11, d$display, d$width, d$height, d$pointsize,  :
  unable to start device X11
In addition: Warning message:
In X11() : unable to open connection to X11 display ''

update 2

I have got the R on cluster worked with plots. But on the rstudio part, still no luck.

I installed xming server as the SSH plot view window. And configure the X display value in putty. Now I can get the plot(cars) showed on the Xming window.

For rstudio, I don't know how to enable x11. Does some one know this? Please help!

I am answering my own question. Which is a work around solution. But to myself, which is better.

My Rstudio-server is still NOT working with png/jpeg file. BUT, it works with javascript!! That means I can create javascript styple plots.

Please check the rChart example here:

http://ramnathv.github.io/rCharts/

Install package rChart and run the first example.

This is awesome 在此输入图像描述 !!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM