R 如何将unicode符号转换为ggplot的因子级别?

R 如何将unicode符号转换为ggplot的因子级别?,r,ggplot2,R,Ggplot2,我想在ggplot图例中获得一个符号,而不在比例中指定 我想要这个: df <- data.frame(a=1:5, b=factor(1:5, labels=c(1:4, "\u2265 5")), c=10:14) ggplot(df, aes(a,c, color=b)) + geom_point() 可能吗 > sessionInfo() R version 3.1.2 (2014-10-31) Platform: i386-w64-mingw32/i386 (32-b

我想在ggplot图例中获得一个符号,而不在比例中指定

我想要这个:

df <- data.frame(a=1:5, b=factor(1:5, labels=c(1:4, "\u2265 5")), c=10:14)

ggplot(df, aes(a,c, color=b)) + geom_point()

可能吗

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_1.0.0

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4   digest_0.6.4       grid_3.1.2        
 [4] gtable_0.1.2       labeling_0.3       MASS_7.3-35       
 [7] munsell_0.4.2      plyr_1.8.1         proto_0.3-10      
[10] RColorBrewer_1.0-5 Rcpp_0.11.3        reshape2_1.4      
[13] scales_0.2.4       stringr_0.6.2      tools_3.1.2 

如果将
b
的系数级别命名为
1
2
3
4
≥5
,是的。@RomanLuštrik问题在于
正在转换为data.frame(在我的Windows 7 PC上)中的
=
。尝试
labels=c(1:4,“\u2265”);标签
。我已经测试过了,它确实不起作用。有意思。嗯,在我的系统
R版本3.0.2(2013-09-25)平台上:x86_64-suse-linux-gnu(64位)
data.frame以及图例都可以。@redmode!最有可能出现windows问题(与往常一样)。
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ggplot2_1.0.0

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4   digest_0.6.4       grid_3.1.2        
 [4] gtable_0.1.2       labeling_0.3       MASS_7.3-35       
 [7] munsell_0.4.2      plyr_1.8.1         proto_0.3-10      
[10] RColorBrewer_1.0-5 Rcpp_0.11.3        reshape2_1.4      
[13] scales_0.2.4       stringr_0.6.2      tools_3.1.2