After installing R 3.6.3 on our lab's computing cluster, characters no longer show up correctly when plotting to png. For example, the axis label that should be the number 2 shows up as a small box containing the digits "0032", which is the Unicode code for 2 (as in this example). Plotting to pdf is fine.
R is installed using homebrew, in /home/linuxbrew/.linuxbrew/bin/R
. I suspect this is an issue with R not being installed with proper support for plotting to png, or something along those lines.
This problem is pretty hard to search for, because I kept finding posts about Unicode characters showing up weird symbols, rather than as their codes. So, suggestions on better terms to search would be welcomed! Based on what I did find, we tried (re)installing cairo and pango using brew, and then reinstalling R, but this didn't help.
I have tried to install the Cairo R package in order to be able to use the CairoPNG
device, but this fails with the message below - it seems R can't find cairo even though it's installed.
checking for pkg-config... /home/linuxbrew/.linuxbrew/bin/pkg-config
checking whether pkg-config knows about cairo... no
configure: CAIRO_LIBS is unset, attempting to guess it.
configure: CAIRO_CFLAGS=
checking if R was compiled with the RConn patch... no
checking cairo.h usability... no
checking cairo.h presence... no
checking for cairo.h... no
configure: error: Cannot find cairo.h! Please install cairo (http://www.cairographics.org/) and/or set CAIRO_CFLAGS/LIBS correspondingly.
ERROR: configuration failed for package ‘Cairo’
It may be relevant that I am the admin / I do not have sudo access on this machine, so I'm installing R packages into a personal library.
capabilities()
and sessionInfo are as follows:
> capabilities()
jpeg png tiff tcltk X11 aqua
TRUE TRUE FALSE FALSE FALSE FALSE
http/ftp sockets libxml fifo cledit iconv
TRUE TRUE TRUE TRUE TRUE TRUE
NLS profmem cairo ICU long.double libcurl
TRUE TRUE TRUE TRUE TRUE TRUE
> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux release 6.10 (Carbon)
Matrix products: default
BLAS/LAPACK: /home/linuxbrew/.linuxbrew/Cellar/openblas/0.3.9/lib/libopenblasp-r0.3.9.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] 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
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.3 tools_3.6.3