在ggplot2中,传说与我的知识有关,我相信这可能是我的问题,但我无法弄清楚为什么我的传说没有表现出来的解决方案。我已经阅读了其他帖子进行了调整,但仍无法让它们显示出来。
任何建议都表示赞赏。
下面的rawAuto数据
LoanType Excessive Income LoanStatus
1: VL 0 0 WITHDRAWN
2: VL 0 0 WITHDRAWN
3: VL 0 0 WITHDRAWN
4: VL 0 0 WITHDRAWN
5: VL 1 0 DECLINED
6: VL 0 0 WITHDRAWN
7: VL 1 0 DECLINED
8: VL 0 0 WITHDRAWN
9: VL 0 0 INSTANT APPROVED
10: VL 0 0 WITHDRAWN
11: VL 0 0 INSTANT APPROVED
12: VL 0 0 PRE-APPROVED
13: VL 0 0 WITHDRAWN
14: VL 0 0 INSTANT APPROVED
15: VL 0 0 INSTANT APPROVED
16: VL 0 0 INSTANT APPROVED
17: VL 0 0 PRE-APPROVED
18: VL 0 0 INSTANT APPROVED
19: VL 1 0 DECLINED
20: VL 0 0 WITHDRAWN
ggplot(rawAuto, aes(LoanStatus)) +
stat_count(aes(LoanStatus, y = ..count..), show.legend = T,
geom = "bar", color = "grey") +
stat_count(data = rawAuto[Excessive == 0 & Income == 0], aes(LoanStatus, y = ..count..),
geom = "point", color = "red", show.legend = T) +
scale_size_continuous(range = c(4, 8)) +
scale_y_continuous(labels = comma, breaks =
c(0,600,1200,1800,2400,3000,3600,4200,4800,5400,6000)) +
labs(title = "Total auto applications vs. excluding 'Excessive' and
'Insufficient Income' denial reasons", x = "Loan Status",
y = "Auto loan Counts") +
theme(axis.text.y = element_text(size = 15)) +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
scale_colour_manual(name = 'Legend', values = c("grey"= "grey",
"red"= "red"), labels = c('All auto','Subset auto'))