1

Currently I am working on the R Studio Pro server from my university. I am trying to plot the following using the library ggplot2:

 starttijdstipvanladenvergelijken %>%
  ggplot(aes(x=StartConnectionHour, y = perc)) +
   geom_line() +
   geom_point()

But unfortunately, I get this error:

Error in RStudioGD() : Shadow graphics device error: r error 4 (R code execution error) In addition: Warning message: In grDevices:::png("/tmp/Rtmpn4W7ks/5fd6f31151e54efab921f12ea1e3591b.png", : unable to open connection to X11 display ''

PS: When I switch from R version 3.6.3 to 3.6.1, I don't get an error, only when I am trying to plot the graph in R version 3.6.3

1 Answers1

1

This message indicates you do not have write access to folder /tmp/Rtmpn4W7ks/

Possibly because the folder does not exist (can you create this folder?)

or because you are not the owner, or another file system permissions issue.

See further discussion in thread https://github.com/rstudio/rstudio/issues/2214

M.Viking
  • 5,067
  • 4
  • 17
  • 33
  • I created the folder that's 'missing' but it still doesn't work and I still get the same error .. – daniël.vandijk Mar 10 '21 at 17:58
  • Per this thread - https://stackoverflow.com/q/50995461/10276092 - What is the output of this command in both R versions -- `capabilities()` – M.Viking Mar 10 '21 at 18:53
  • In version 3.6.3: jpeg png tiff tcltk X11 aqua http/ftp sockets FALSE FALSE FALSE TRUE FALSE FALSE TRUE TRUE libxml fifo cledit iconv NLS profmem cairo ICU TRUE TRUE TRUE TRUE TRUE FALSE FALSE TRUE long.double libcurl TRUE TRUE – daniël.vandijk Mar 11 '21 at 08:20
  • In version 3.6.1: jpeg png tiff tcltk X11 aqua http/ftp sockets TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE libxml fifo cledit iconv NLS profmem cairo ICU TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE long.double libcurl TRUE TRUE – daniël.vandijk Mar 11 '21 at 08:29
  • In the capabilities() you posted for version 3.6.3, both "png" and "cairo" are false. Searching on the "Shadow graphics device error: r error 4" error message you posted, I see many threads about system level libraries needing to be installed, I think you should escalate this issue to the system administrators or helpdesk. – M.Viking Mar 11 '21 at 13:27
  • 1
    Thank you for your response. I escalated this issue to my system administrator. Waiting for a reply now .. – daniël.vandijk Apr 09 '21 at 13:06
  • This might happen if they compiled R from source and the compiler didn't see certain libraries (x, png, cairo/pango) or certain `./configure` flags (--with-x, --with-cairo, --with-libpng). I had trouble compiling R and cairo not working - what helped after the fact was the run time option `options(bitmapType='cairo')` – M.Viking Apr 09 '21 at 15:36
  • Give the command in this thread a try too https://unix.stackexchange.com/a/31301/367012 `Sys.setenv("DISPLAY"=":0.0")` – M.Viking Apr 09 '21 at 15:39