r - Windows 10 上的 R 输出中缺少 Unicode 字符
问题描述
我在 Windows 10 上运行 R。
我在将 Unicode 符号显示为点的形状时遇到问题。(我试图在我的火山图(\u2B06,⬆)中放置一个向上箭头,以获取超出比例的点)。有些工作,有些不工作。 示例源
TestUnicode <- function(start="25a0", end="25ff", ...)
{
nstart <- as.hexmode(start)
nend <- as.hexmode(end)
r <- nstart:nend
s <- ceiling(sqrt(length(r)))
par(pty="s")
plot(c(-1,(s)), c(-1,(s)), type="n", xlab="", ylab="",
xaxs="i", yaxs="i")
grid(s+1, s+1, lty=1)
for(i in seq(r)) {
try(points(i%%s, i%/%s, pch=-1*r[i],...))
}
}
TestUnicode()
TestUnicode(9500,9900)
在我的系统上,一些字符只是显示为空方框。
到目前为止,我了解到这是由 Windows 字体问题引起的,并且很可能是由 Windows 10 存储字体的新方式引起的。
我发现的大多数类似问题的解决方案都遗憾地适用于基于 Unix 的系统并使用:
Sys.setlocale( locale="UTF-8" )
我假设这是一个 Unix 命令,因为它给了我以下信息:
[1] ""
Warning message:
In Sys.setlocale(locale = "UTF-8") :
OS reports request to set locale to "UTF-8" cannot be honored
我尝试了使用“showtext”包的解决方案,但不知何故,这也不起作用,Windows 10 可能再次成为麻烦制造者。(安装“诺托”)
library(showtext)
font_paths()
[1] "C:\\Windows\\Fonts"
font_add(family="Noto", regular="NotoSansSymbols-Regular.ttf")
plot(1,1,pch='⬆',family='Noto')
There were 12 warnings (use warnings() to see them)
warnings()
Warning messages:
1: In plot.xy(xy, type, ...) : font family not found in Windows font database
有没有人有办法解决吗 ?将不胜感激任何帮助<3
解决方案
推荐阅读
- android - ACR38U-I1 Android 驱动程序:无法从英飞凌 SLE4428 智能卡读取密钥
- c# - 独特的动态面板 - 区分动态生成的面板 - C#
- docker - 在容器内装载卷
- javascript - 如何使 div 缩小以适应容器保持其相对宽度?
- javascript - 如何在 package-lock.json 中找到额外的包
- javascript - 如何在javascript中实现轮询
- python - KeyError:“索引(列,dtype ='object')不在索引中”
- c++ - while 语句中的条件顺序
- java - 动态泛型 Java
- android-studio - 为什么服务类没有收到意图,因为它不断给出 java.lang.RuntimeException