As you can see in this post someone found the solution to my problem where the text in my ggplot2 graphs were replaced by unicode-blocks. This was caused by an error in the default font settings of ggplot2 (base_family = ""). Therefore, the workaround was to manually set the base_family argument to "Arial".
Here you can see an example code:
# Libraries
library(ggplot2)
# create data
xValue <- 1:10
yValue <- cumsum(rnorm(10))
data <- data.frame(xValue,yValue)
# Plot
ggplot(data, aes(x=xValue, y=yValue)) +
geom_line() +
theme_classic()
The resulting graph looks like this where the text is shown in weird unicode blocks (sorry I do not know what these are called exactly):
I can manually solve the issue by setting the theme base_family to "Arial":
# Libraries
library(ggplot2)
# create data
set.seed(42)
xValue <- 1:10
yValue <- cumsum(rnorm(10))
data <- data.frame(xValue,yValue)
# Plot
ggplot(data, aes(x=xValue, y=yValue)) +
geom_line() +
theme_classic(base_family = "Arial")
This is the image of the resolved issue, which only works if the base_family is set to a specific font like "Arial":
The question is why does my system somehow conflict with the default font and how can I set the default font back to normal? Because now I have to call the base_family = "Arial"
Argument in every plot I make with ggplot2. I should mention, that I have no font issues with e.g. plotly whatsoever. I have not found any similar problems except a link on how to change the default setting for a specific theme type but I would like to reset the settings back to normal so base_family = ""
works again. I hope you can help me out and please do not hesitate if you need further information from me.
R version: 3.6.1 (2019-07-05)
platform: linux mint x86_64
conda environment