在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/數(shù)據(jù)分析&挖掘  數(shù)據(jù)庫  網(wǎng)絡(luò)安全/ 關(guān)于ggplot2主題設(shè)置的問題

關(guān)于ggplot2主題設(shè)置的問題

手抄《R語言實戰(zhàn)》中的主題設(shè)置代碼,不知道為什么老是報錯,代碼如下:

library(ggplot2)
data(Salaries, package='car')

mytheme<-(plot.title=element_text(face='bold.italic',size=14,color='brown',hjust=0.5),
          axis.title=element_text(face='bold.italic',size='10',color='brown'),
          axis.text=element_text(face='bold.italic',size='9',color='darkblue'),
          panel.background=element_rect(fill='white',color='darkblue'),
          panel.grid.major.y=elemnt_line(color='grey',linetype=1),
          panel.grid.minor.y=element_line(color='grey', linetype=2),
          panel.grid.minor.x=element_blank())



ggplot(Salaries, aes(x=rank,y=salary,fill=sex)) + 
  geom_boxplot() +
  labs(title='Salary by Rank and Sex',x='RANK',y='Salary') +
  mytheme

報錯信息如下:

> source('~/.active-rstudio-document')
Error in source("~/.active-rstudio-document") : 
  ~/.active-rstudio-document:18:86: unexpected ','
17: 
18: mytheme<-(plot.title=element_text(face='bold.italic',size=14,color='brown',hjust=0.5),
                                                                                         ^

逗號也沒有錯啊,是英文的,請問到底是哪里錯了,謝謝!

回答
編輯回答
鐧簞噯

漏了theme(),犯了個2b錯誤。。。

2017年8月1日 19:13