ggplot(data = d1.6, aes(x = index, y = value, shape = variable)) +
geom_point() +
labs(x = "index", y = "tensile strength") +
scale_shape_manual(name = "temperature", values = c(19, 5), labels = c("20°C", "40°C")) +
theme(text = element_text(family = "Arial Unicode MS"))
> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.13.4 (unknown)
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] MASS_7.3-45 reshape2_1.4.3 ggplot2_3.0.0
loaded via a namespace (and not attached):
[1] Rcpp_0.12.18 rstudioapi_0.7 bindr_0.1.1 magrittr_1.5 tidyselect_0.2.4
[6] munsell_0.5.0 colorspace_1.3-2 R6_2.2.2 rlang_0.2.2 stringr_1.3.1
[11] plyr_1.8.4 dplyr_0.7.6 tools_3.3.1 grid_3.3.1 gtable_0.2.0
[16] withr_2.1.2 yaml_2.2.0 lazyeval_0.2.1 assertthat_0.2.0 digest_0.6.16
[21] tibble_1.4.2 crayon_1.3.4 bindrcpp_0.2.2 purrr_0.2.5 glue_1.3.0
[26] labeling_0.3 stringi_1.2.4 pillar_1.3.0 scales_1.0.0 pkgconfig_2.0.2
指定Unicode支持字体不会使Unicode字符正常显示。如果您不想查看图像,则将字符(°)替换为“ ..”。
答案 0 :(得分:0)
问题是我的R语言环境是“ C”。通过将其更改为其他选项(中文):
system("defaults write org.R-project.R force.LANG zh_CN.UTF-8")
然后重新启动RConsole,它可以完美运行。