文本在 R 图中未正确显示 [英] Text does not show properly in R plot

查看:57
本文介绍了文本在 R 图中未正确显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 R 安装在 Ubuntu 20.04.1 VM 上的 conda 环境中.

My R was installed in a conda environment on Ubuntu 20.04.1 VM.

推荐答案

当我发现这个线程时,我正在寻找这个问题.我也在 Debian 10.0 (buster) 上使用 Anaconda 的 RStudio.

I was searching for this problem when i found this thread. I too am using RStudio from Anaconda, on Debian 10.0 (buster).

试试

par(family  = "Arial")

或调用 plot() 之前的任何字体名称.它对我有用.更新 > 我仍然遇到 ggplot2 绘图不显示标签的问题,如上所示.我尝试了使用 showtext() 而不是常规文本呈现的解决方法.

or whichever font name before calling plot(). It worked for me. Update > I still had problems with ggplot2 plots not displaying labels, like above. I tried the workaround of using showtext() instead of regular text rendering.

install.packages("showtext")

安装后,

library(showtext)

加载库.然后只需调用

showtext_auto()

接着是 ggplot(.....) + ... + 等 函数,文本在情节中渲染得很好.我没有使用 font_add() 加载特定字体.可能是因为之前 'Arial' 加载了 par()

followed by the ggplot(.....) + ... + etc. function and text was rendered alright within the plot. I did not load specific fonts using font_add(). Maybe because previously 'Arial' was loaded with par()

这篇关于文本在 R 图中未正确显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆