Fail to use unicode character “per ten thousand” a

2019-08-12 07:22发布

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?

1条回答
地球回转人心会变
2楼-- · 2019-08-12 08:03

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")

resulting plot

Consult this tutorial for changing fonts in ggplot2.

查看更多
登录 后发表回答