使用ggplot出现以下报错,不知道是哪个元素出错了,请问一下应该怎么修改
ggplot(Cellratio) +
+ geom_bar(aes(x =GSM, y= Freq, fill = Celltype),stat = "identity",width = 0.7,size = 0.5,colour = '#222222')+
+ theme_classic() +
+ labs(x='Cell cycle phase',y = 'Ratio')+
+ theme(panel.border = element_rect(fill=NA,color="black", size=0.5, linetype="solid"),legend.position = "right")+ # 图例:"left" 左, "right" 右, "bottom" 下, "top" 上
+ scale_fill_manual(values=colaa[sample(1:length(colaa), size = 25)])+
+ theme_bw()+
+ xlab(NULL)+
+ theme(axis.text.x = element_blank())+
+ guides(fill = guide_legend( ncol = 1, byrow = TRUE))+
+ facet_grid(. ~ Type,scales="free")+
+ theme(strip.text.x = element_text(size = 30,colour = "black"))+ #分面字体颜色
+ theme(strip.background.x = element_rect(fill = c("white"), colour = "black")) #分面颜色
+ ggsave("immune.ration.pdf",width = 15,height = 8) #输出图片
Error: unexpected symbol in:
" theme(strip.background.x = element_rect(fill = c("white"), colour = "black")) #分面颜色
ggsave"
多了个+号,改完这样的
ggplot(Cellratio) +
geom_bar(aes(x =GSM, y= Freq, fill = Celltype),stat = "identity",width = 0.7,size = 0.5,colour = '#222222')+
theme_classic() +
labs(x='Cell cycle phase',y = 'Ratio')+
theme(panel.border = element_rect(fill=NA,color="black", size=0.5, linetype="solid"),legend.position = "right")+ # 图例:"left" 左, "right" 右, "bottom" 下, "top" 上
scale_fill_manual(values=colaa[sample(1:length(colaa), size = 25)])+
theme_bw()+
xlab(NULL)+
theme(axis.text.x = element_blank())+
guides(fill = guide_legend( ncol = 1, byrow = TRUE))+
facet_grid(. ~ Type,scales="free")+
theme(strip.text.x = element_text(size = 30,colour = "black"))+ #分面字体颜色
theme(strip.background.x = element_rect(fill = c("white"), colour = "black"))) #分面颜色
ggsave("immune.ration.pdf",width = 15,height = 8) #输出图片