条形图ggplot2中的y轴绘制错误

时间:2020-07-28 01:28:01

标签: r ggplot2 scale yaxis

我正在尝试制作一个简单的水平条形图,并且y轴比例似乎已关闭(参见图片)。任何指针都值得赞赏

L<- data.frame(Language=c("Eng(P) and Spa(S)","Spa(P) and Eng (S)","Eng-only","Spa-only"), Percent=c("53","27","10","10"))
L$Language <- factor(L$Lang, levels = rev(unique(L$Language)), ordered=TRUE)
L$Language<-as.factor(L$Language)
L1<-ggplot(data=L, aes(x=Language, y=Percent, fill=Language)) + 
  geom_bar(stat="identity") +  
  scale_fill_brewer(palette="Set1") + scale_y_discrete(name="Percent")+
  scale_x_discrete(name="",limits= L$Language) + theme(text = element_text(family="Calibri",size = 14))+theme(axis.text = element_text(family="Calibri",size = 12))
L1 + coord_flip()

y轴比例错误的水平条形图

enter image description here

0 个答案:

没有答案