未能使用unicode字符“每一千个”作为轴标签 [英] Fail to use unicode character "per ten thousand" as axis label
本文介绍了未能使用unicode字符“每一千个”作为轴标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 ggplot2
的轴标上添加每万个符号。
要插入每千个符号,我可以使用:
library(ggplot2)
qplot(1,1) + ylab(\\\‰)
但是当我使用
qplot(1,1)+ ylab(\\\‱)
生成每万个符号,生成的输出是包含问号的框。使用的文本系列是Calibri,但是默认文本系列会生成相同的输出。
是否支持此符号?
解决方案
您需要使用支持此符号的字体。从
咨询本教程用于更改ggplot2中的字体。
I would like to add the "per ten thousand" symbol to an axis label with ggplot2
.
To insert the "per thousand" symbol I can use :
library(ggplot2)
qplot(1, 1) + ylab("\u2030")
But when I use
qplot(1, 1) + ylab("\u2031")
to generate the "per ten thousand" symbol, the output generated is a box containing a question mark. The text family used is Calibri, however the same output is generated with the default text family.
Is this symbol supported?
解决方案
You need to use a font that supports this symbol. From this list I tried Arial Unicode MS
:
windowsFonts(
A=windowsFont("Arial Unicode MS")
)
plot(1)
text(1, 1.2,"\u2031", family = "A")
Consult this tutorial for changing fonts in ggplot2.
这篇关于未能使用unicode字符“每一千个”作为轴标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文