I am trying to plot using Rstudio. But when I do, I am getting an Graphics Error in R. Here is what I have done :
yum install cairo cairo-devel cairomm-devel libjpeg-turbo libjpeg-turbo-devel pango pango-devel pangomm pangomm-devel libtiff libtiff-devel libXt libXt-devel libpng libpng-devel
> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C 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 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2_3.1.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.1 withr_2.1.2 assertthat_0.2.1 crayon_1.3.4 dplyr_0.8.0.1 R6_2.4.0
[7] grid_3.5.2 plyr_1.8.4 gtable_0.3.0 magrittr_1.5 scales_1.0.0 pillar_1.3.1
[13] rlang_0.3.4 lazyeval_0.2.2 rstudioapi_0.10 tools_3.5.2 glue_1.3.1 purrr_0.3.2
[19] munsell_0.5.0 compiler_3.5.2 pkgconfig_2.0.2 colorspace_1.4-1 tidyselect_0.2.5 tibble_2.1.1
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp sockets libxml
TRUE TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE
fifo cledit iconv NLS profmem cairo ICU long.double libcurl
TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
Warning message:
In doTryCatch(return(expr), name, parentenv, handler) :
unable to load shared object '/usr/lib64/R/modules//R_X11.so':
/usr/lib64/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates
> library(ggplot2)
> ggplot(mtcars, aes(factor(cyl), mpg)) + geom_violin(aes(fill = cyl))
Error in RStudioGD() :
Shadow graphics device error: r error 4 (R code execution error)
In addition: There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In grDevices:::png("/tmp/RtmpqJD7g6/2c22d9968be54dd48ead81d0a29fa0f2.png", ... :
failed to load cairo DLL
2: In grDevices:::png("/tmp/RtmpqJD7g6/3802e757470f48c8a14ab91ea2c99c54.png", ... :
failed to load cairo DLL
Please guide me through,How would I fix this? Thanks