作者:黃天元,復旦大學博士在讀,熱愛數據科學與開源工具(R),致力于利用數據科學迅速積累行業經驗優勢和科學知識發現,涉獵內容包括但不限于信息計量、機器學習、數據可視化、應用統計建模、知識圖譜等。知乎專欄:R語言數據挖掘。郵箱:huang.tian-yuan@qq.com.歡迎合作交流。
下面這段代碼能夠把環境設置成科研專用的字體環境,如果使用ggplot可以率先運行這一段,在進行畫圖。
myfree<-theme_set(theme_bw())
windowsFonts(HEL=windowsFont("Helvetica CE 55 Roman"),RMN=windowsFont("Times New Roman"),ARL=windowsFont("Arial"))
old_theme <- theme_update(plot.title=element_text(family="ARL", size=22, face="bold", colour="black"),axis.title.x=element_text(family="HEL", size=18,face="bold", colour="black"),axis.title.y=element_text(family="HEL", size=18, face="bold",angle=90, colour="black"),axis.text.x=element_text(family="RMN", size=16, colour="black"),axis.text.y=element_text(family="RMN", size=16, colour="black"),axis.ticks=element_line(colour="black"),panel.grid.major=element_blank(),panel.grid.minor=element_blank(),panel.background=element_blank(),axis.line=element_line(size=1)
)
也可以根據自己的需要修改參數。如果需要原來的設置,要重啟R。目前還沒有探索到能夠馬上恢復的方法,如果有的話請各位大神教一下。