将度数符号 (°) 添加到 ggplot2 中的轴标签

Gas*_*par -2 label axis r ggplot2

我想将度数符号 (\xc2\xb0) 添加到 y 轴上的标签(而不是轴标题)。我在该轴上有一个排名,数字范围为 1-11,我希望每个人都说“1\xc2\xb0”,而不仅仅是“1”。有没有办法做到这一点?

\n

r2e*_*ans 5

我的第一个倾向是研究表达式和plotmath类似的东西,但在这种情况下,我们可以简单地将度数符号添加到文本中。

\n
library(ggplot2)\nggplot(mtcars, aes(disp, cyl)) +\n  geom_point() +\n  scale_y_continuous(labels = ~ paste0(.x, "\xc2\xb0"))\n
Run Code Online (Sandbox Code Playgroud)\n

ggplot 在 y 轴标签中带有度数

\n