R3.1.1中的ggplot错误
我试图在R中绘制一个简单的条形图,使用Windows8上R3.1.1中的R3.1.1中的ggplot错误,r,ggplot2,R,Ggplot2,我试图在R中绘制一个简单的条形图,使用Windows8上R3.1.1中的ggplot。下面是一段代码: ggplot(sent_df, aes(x=emotion)) + geom_bar(aes(y=..count.., fill=emotion)) + scale_fill_brewer(palette="Dark2") + labs(x="emotion categories", y="number of comments") + opts(title = "classification
ggplot
。下面是一段代码:
ggplot(sent_df, aes(x=emotion))
+ geom_bar(aes(y=..count.., fill=emotion))
+ scale_fill_brewer(palette="Dark2")
+ labs(x="emotion categories", y="number of comments")
+ opts(title = "classification by emotion", plot.title = theme_text(size=12))
使用发送\u df
数据帧,但收到错误:
错误:请改用“主题”。(已失效;上次在版本0.9.1中使用)
opts不再使用。相反,您必须使用
主题
试试这个
ggplot(sent_df, aes(x=emotion)) + geom_bar(aes(y=..count.., fill=emotion)) +
scale_fill_brewer(palette="Dark2") + labs(x="emotion categories", y="number of comments",
title = "classification by emotion") + theme(plot.title = element_text(size=12))
有关更多详细信息,请参阅ggplot2文档。谢谢您的帮助。@Mudit如果对您有效,请接受我的答案