plot panel not working in Rstudio server

Hi

We are using an RStudio server running on CentOS.

We cannot display plots in the Plot Panel of the IDE. The error is

In fun(libname, pkgname) : couldn't connect to display ":0"

Here is the detailed R session we are using

sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.5 (Final)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C
[5] LC_MONETARY=C LC_MESSAGES=C LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C

attached base packages:
[1] grid tcltk stats graphics grDevices utils datasets methods base

other attached packages:
[1] Riops_0.2-1 maps_3.3.0 reshape2_1.4.3 ggplot2_3.1.0 xtable_1.8-3 oce_1.0-1
[7] gsw_1.0-5 testthat_2.0.1 knitr_1.20 brew_1.0-6 stringr_1.3.1 e1071_1.6-8

loaded via a namespace (and not attached):
[1] Rcpp_0.12.19 compiler_3.4.3 pillar_1.3.0 plyr_1.8.4 bindr_0.1.1
[6] class_7.3-14 tools_3.4.3 tibble_1.4.2 gtable_0.2.0 pkgconfig_2.0.2
[11] rlang_0.3.0.1 rstudioapi_0.7 bindrcpp_0.2.2 withr_2.1.2 dplyr_0.7.6
[16] tidyselect_0.2.4 glue_1.3.0 R6_2.3.0 purrr_0.2.5 magrittr_1.5
[21] scales_1.0.0 assertthat_0.2.0 colorspace_1.3-2 stringi_1.2.4 lazyeval_0.2.1
[26] munsell_0.5.0 crayon_1.3.4 rstudio_0.98.507

Hi @sbe! Welcome!

What code are you running that produces this error? If the code is written assuming it can access the local machine’s display, you may not be able to use it with RStudio Server. See:

(That post is about RStudio Cloud, but I believe it also applies to RStudio Server, which Cloud uses)

Thanks for the reply.

I am just trying to use the plot() function to explore the data (really basic). But nothing is plotted in the bottom right panel. So something is wrong with the display variables. Not sure whether this is a problem with CentOS server or the RStudio Server config.

Any idea?

Simon