在R中使用Mac从右到左语言支持 [英] Right to left languages support in R, using Mac
问题描述
我想知道在使用Mac时是否支持从右到左的语言
例如假设下面的代码:
x < - data.frame(a = runif(10),b = runif(10))
ggplot(x,aes (a,b))+ geom_point()+ xlab(سلام)
:
在这里,我尝试将x标签更改为波斯语/阿拉伯语单词(سلام= Hello)。虽然在代码中正确显示(使用R-Studio),但在图中,سلام的字符以相反的顺序(从左到右)显示。
同时还有两个连续字母之间的联系(即与ل连接的س将是سل)已被打破。
您有任何想法如何解决它?
更新
在@agstudy的答案中,我发现Ubuntu下的R是完全正确的。然而,我不知道如何解决Mac(OS X 10.9.1)中具有R和R-Studio更新版本的问题。
解决方案对我来说它工作得很好。
library(ggplot2)
x< - data.frame我只是更改标签的大小以便更好地显示它。 (a = runif(10),b = runif(10))
ggplot(x,aes(a,b))+
geom_point()+ xlab('سلام')+
theme(axis.title = element_text(size = 100,face =bold))
我正在使用:
其他附件包:
[1] ggplot2_0.9.3.1
R版本3.0.2(2013-09 -25)
平台:x86_64-w64-mingw32 / x64(64位)
也可以正常工作:
R版本3.0.3(2014-03-06)
平台:x86_64-pc -linux-gnu(64位)
I am wondering if there is anyway to support right-to-left languages in R while using Mac
For instance suppose the following code:
x <- data.frame(a=runif(10),b=runif(10))
ggplot(x, aes(a,b)) + geom_point() + xlab("سلام")
Here is the result:
Here I tried to change the x-label as a Persian/Arabic word (سلام = Hello). While displayed correctly in the code (using R-Studio), in the graph the characters of سلام are displayed in the reverse order (left-to-right).
Also the linkage between two consecutive letters (i.e. س connected to ل would be سل) is broken.
Do you have any idea how to fix it?
Update
With the answer of @agstudy I found R under Ubuntu is perfectly OK. However I have no idea how to solve the problem in Mac (OS X 10.9.1) having updated version of R and R-Studio
It works fine for me. I just change the size of labels to better show it.
library(ggplot2)
x <- data.frame(a=runif(10),b=runif(10))
ggplot(x, aes(a,b)) +
geom_point()+ xlab('سلام') +
theme( axis.title=element_text(size=100,face="bold"))
I am using :
other attached packages:
[1] ggplot2_0.9.3.1
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Also works fine under :
R version 3.0.3 (2014-03-06)
Platform: x86_64-pc-linux-gnu (64-bit)
这篇关于在R中使用Mac从右到左语言支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!