I installed an older version of R (4.0.2) from source on my computer following the instruction on https://support.rstudio.com/hc/en-us/articles/215488098-Installing-multiple-versions-of-R-on-Linux and I work with rmarkdown
and knitr
packages in RStudio for my analyses. I also work with renv
package in order to have a more reproducible environment and code.
My problem is that my plots, which are inline, lack the fonts. Here is an example:
I have a table with 2 columns, PT and M and my code is a simple ggplot:
library(ggplot2)
df <- data.frame( "A" = c(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7),
"M" = c(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2),
"n" = c(3, 29, 13, 7, 0, 3, 0, 22, 13, 4, 3, 1, 0, 1, 8, 3, 4, 1, 0, 0, 0))
ggplot(data = df, aes(x=A, y=M, size = n)) +
geom_point()
I really don't know where the problem comes from: missing package in Linux, problems with R, RStudio or rmarkdown
?
Does someone have an idea ?
SOLUTION
I installed Helvetica.ttf.gz on my ubuntu:
gunzip Helvetica.ttf.gz
sudo mkdir /usr/share/fonts/truetype/myfonts
sudo mv Helvetica.ttf /usr/share/fonts/truetype/myfonts/.
sudo fc-cache -f -v /usr/share/fonts/truetype/myfonts/