瀏覽代碼

add a pic

master
杨浩然 3 年之前
父節點
當前提交
d014acccde
共有 2 個檔案被更改,包括 33 行新增1 行删除
  1. 二進制
      COVID-19/Project/.vs/Project/v16/.suo
  2. +33
    -1
      COVID-19/Project/Project/Project.py

二進制
COVID-19/Project/.vs/Project/v16/.suo 查看文件


+ 33
- 1
COVID-19/Project/Project/Project.py 查看文件

@ -90,7 +90,7 @@ labsChina = [d.get_label() for d in datasChina]
ax1.legend(datasChina, labsChina, loc="lower right")
#美国
ax3 = fig.add_subplot(223)
ax3 = fig.add_subplot(222)
ax3.set_title("Recovered/Confirmed/Recovery Possibility(month) of US",verticalalignment="bottom",fontsize="13")
data3 = ax3.plot(date,confirmedUS,color="red",linewidth="1.7",label="confirmed")
data4 = ax3.plot(date,recoveredUS,color="lime",linewidth="1.7",label="recovered")
@ -102,4 +102,36 @@ datasUS = data3 + data4 + data5
labsUS = [d.get_label() for d in datasUS]
ax3.legend(datasUS, labsUS, loc="upper left")
dataNew = pd.melt(China[['Date','Province/State','Confirmed','Recovered','Deaths']],
id_vars=['Date','Province/State'],value_vars=['Confirmed','Recovered','Deaths'],
var_name='group_var',value_name='Cases')
dataNew['Date'] = pd.to_datetime(dataNew['Date'])
dfNew = China[['Province/State','Confirmed','Recovered','Deaths']].groupby(['Province/State']).sum().reset_index()
dataNew = pd.melt(dfNew,id_vars=['Province/State'],
value_vars=['Confirmed','Deaths','Recovered'],
var_name='group_var',value_name='Cases')
dataNew = dataNew.sort_values(by=['Province/State','group_var']).reset_index(drop=True)
dataNew = dataNew.pivot_table(index=['Province/State'], columns='group_var')
dataNew.columns = dataNew.columns.droplevel().rename(None)
#中国各省份
dataNew.sort_values('Confirmed', inplace=True)
xData = []
yConfirmed = []
yRecovered = []
for i in range(12):
xData.append(dataNew.index[i])
yConfirmed.append(dataNew['Confirmed'][i])
yRecovered.append(dataNew['Recovered'][i])
ax5 = fig.add_subplot(212)
ax5.set_title("Total Recovered/Confirmed of China(the bottom ten)",verticalalignment="bottom",fontsize="13")
barWidth = 0.25
r1 = np.arange(12)
r2 = [x + barWidth for x in r1]
ax5.bar(r1, yConfirmed, color='#FF0088', width=barWidth, edgecolor='white', label='Confirmed')
ax5.bar(r2, yRecovered, color='#00BBFF', width=barWidth, edgecolor='white', label='Recovered')
plt.xticks([r + barWidth for r in range(len(yConfirmed))], xData)
ax5.legend()
plt.show()

Loading…
取消
儲存