R语言中作图字体的设置
生活随笔
收集整理的這篇文章主要介紹了
R语言中作图字体的设置
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
介紹
在R語(yǔ)言中設(shè)置字體時(shí)需要利用**windowsFonts()**加入到字體庫(kù)中,例如:
windowsFonts(myFont = windowsFont("微軟雅黑"))然后在調(diào)用時(shí),用family='myFont’的參數(shù)實(shí)現(xiàn)即可。
改變ggplot()中的字體
my_theme <- theme(panel.background = element_rect(fill = "transparent", colour = NA), plot.background = element_rect(fill = "transparent", colour = NA),legend.background = element_rect(fill = "transparent", colour = NA),panel.grid.minor = element_blank(), panel.grid.major = element_blank(),title=element_text(family="myFont"),legend.text=element_text(size=14,family = 'myFont'),axis.title=element_text(size=14,family = 'myFont'),axis.text = element_text(size=14,family = 'myFont'),strip.text.x=element_text(size=14, family='myFont') )改變plot()中的字體
plot(1:10,1:10,xlab='好好學(xué)習(xí)',ylab='你好',cex.lab=2,family='myFont')改變?nèi)肿煮w:
par(family='myFont')總結(jié)
以上是生活随笔為你收集整理的R语言中作图字体的设置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Shell 加法运算的几种写法
- 下一篇: C语言求解距多个点最短长度,算法设计技巧