ggplot2 doesn't show Chinese character properly in rstudio-server in docker
Try the showtext
package, which was designed for this.
Sample code:
library(ggplot2)library(showtext)showtext_auto()p = ggplot(NULL, aes(x = 1, y = 1)) + ylim(0.8, 1.2) + annotate("text", 1, 1, size = 15, label = "你好,世界") + xlab("坐标轴") + theme_bw(base_family = "wqy-microhei", base_size = 24)quartz()print(p)