我正在尝试构建一个包含 unicode 字符的图(正负号sign U+00B1)
以下是一些虚假数据:
library(tidyverse)
set.seed(1)
df <- crossing(
Rated_Movement = c("Running", "Jumping"),
Rater = c("John Snow", "Batman", "Hulk")) %>%
mutate(
Error = runif(n = 6, min = 0, max=2))
这是到目前为止我的情节代码:
ggplot(df, aes(x = Rated_Movement, y = Rater, fill = Error)) +
geom_tile(color = "black", size = 0.5, alpha = 0.8)+
geom_text(aes(label = paste("+-", round(Error,2))))+
scale_fill_gradientn(colours = terrain.colors(10))+
theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())
Here is the plot:
有没有办法可以将 +- 更改为 unicode 字符 U+00B1
我尝试使用反斜杠来转义:
粘贴(“\ U + 00B1”,轮(错误,2))
但我收到错误:
“错误:以“\U”开头的字符串中没有使用十六进制数字“\U””
任何帮助都感激不尽。
此致