如何按月订购?

时间:2017-10-01 15:33:30

标签: r ggplot2

我在factor()中尝试了aes功能,但它无法用于订购1月到12月的月份。我该如何修复代码?感谢。

LC10 <- read_excel("C:/Users/Austin/Desktop/Final Project/LC1.xlsx", sheet = 9)

ggplot(data=LC10, aes(x=factor(Month), y = Chargeoffs9))+ 
       annotation_custom(grob1,xmin = -Inf, xmax = Inf, ymin = 0.03, ymax = 0.10) + 
       geom_bar(aes(fill=Month), stat="identity", alpha = 0.6) + 
       scale_y_continuous(labels=scales::percent) + 
       theme_bw(base_size = 16) + theme_classic() +
       theme(axis.text.x=element_text(angle=45, hjust=1)) + 
       ggtitle("Month of Loans vs. Charge-Offs") + 
       theme(plot.title = element_text(hjust = 0.5), legend.position="none") + 
       labs(x = "Month of Loans", y="Percent of Charge-Offs")

这就是它的样子:

enter image description here

0 个答案:

没有答案
相关问题