问题描述
plt.figure(figsize=(30,7))
# Plot 1: Line chart for loan distribution over years
plt.subplot(1,4,1)
cx = loan_data.groupby('issue_d_year').loan_amnt.count().plot(kind='line',fontsize=7)
for p in cx.patches:
cx.annotate(format(p.get_height(),'.2f'),(p.get_x() + p.get_width() / 2.,p.get_height()),ha = 'center',va = 'center',xytext = (0,10),textcoords = 'offset points')
plt.title("Number of Loans over years",weight ='bold')
plt.ylabel("Count of loan amount")
plt.xlabel("Loans funded across years")
# Plot 2: bar chart for loan distribution over years
plt.subplot(1,2)
cxs = loan_data.groupby('issue_d_year').loan_amnt.count().plot(kind='bar',fontsize=7)
for p in cxs.patches:
cxs.annotate(format(p.get_height(),weight ='bold')
plt.ylabel("Count of loan amount")
plt.xlabel("Loans funded across years")
plt.figure(figsize=(70,7))
# Plot 3: Line chart for loan distribution over months
plt.subplot(1,3)
dx = loan_data.groupby('issue_d_month').loan_amnt.count().plot(kind='line',fontsize=7)
for p in dx.patches:
dx.annotate(format(p.get_height(),textcoords = 'offset points')
plt.title("Number of Loans over months",weight ='bold')
plt.ylabel("Count of loan amount")
plt.xlabel("Loans funded across months")
# Plot 4: Bar chart for loan distribution over months
plt.subplot(1,4)
dxs = loan_data.groupby('issue_d_month').loan_amnt.count().plot(kind='bar',fontsize=7)
for p in dxs.patches:
dxs.annotate(format(p.get_height(),weight ='bold')
plt.ylabel("Count of loan amount")
plt.xlabel("Loans funded across months")
plt.show()
输出:
有没有办法我可以将前2个图表合并为一个,将底部2个图表合并为一个,并用红色将线涂成红色
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)