Problem with Greek letters in plots

I was reading this post

Mu is rendered as just an "m" in pdf

and thought i would try @ startz solution

library(latex2exp)
x  <-   1
y <-   1
plot(x,y,xlab=TeX(paste("a","$\\mu$","b")))

However I am getting

plot(x,y, xlab=TeX(paste("a","\\mu","b")))
Error in title(...) : invalid use of -956 < 0 in 'X11_MetricInfo'


A simple example using expression, and without *(latex2exp* gives the same result in a new RStudio session and in an external R terminal session.

set.seed(1) # for reproducible, pseudo-random numbers
betas <- rnorm(1000)
hist(betas, main = expression(beta))
Error in title(main = main, sub = sub, xlab = xlab, ylab = ylab, ...) :
invalid use of -946 < 0 in 'X11_MetricInfo'


  sessionInfo()

R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 21.10

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

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_CA.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_CA.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_CA.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_CA.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_4.1.2 tools_4.1.2


I don't really have any reason to use Greek letters in plots and have no idea how to troubleshoot this.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.