Fight against new coronavirus: a balanced analysis of national cure and new cases

# default_exp china
# The above line is used to declare the name of this module in nbdev. Must be the first row of the first Cell of the notebook.

china_balance

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import *  
china = pd.read_csv("./data/china.csv")
china = china.sort_values(by='date')
china_t = china
china_t['balance']=china['Newly diagnosed']-(china['New cure']+china['New death'])

Trend mapping

# Drawing trend chart of increase 
def drawb(dfx):
    myfont = FontProperties(fname='/usr/share/fonts/truetype/arphic/ukai.ttc',size=24)  
    fig=plt.figure(figsize=(48,12), dpi=250)
    p1=fig.add_subplot(1,1,1)
    p1.set_xticklabels(dfx['date'], rotation=15, fontsize='small',fontproperties=myfont)

    #Display data.
    p1.plot(dfx['date'],dfx['balance'],color='blue',linewidth=3,label='Balance [new diagnosis-(New cure+New death)]')
    p1.plot(dfx['date'],dfx['Newly diagnosed'],color='#BB0000',linewidth=1,label =' new diagnosis')
    p1.plot(dfx['date'],dfx['Existing diagnosis'],color='red',linewidth=1,label='Existing diagnosis')
    p1.plot(dfx['date'],dfx['New cure'],color='green',linewidth=1,label='New cure')

    p1.bar(dfx['date'],dfx['New death'],color='black',label='New death')

    plt.title(u'National cases(COVID-2019)Increase / decrease quantity balance-2020 Year 01-02 month,Data source: http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml',fontproperties=myfont) 
    plt.legend(loc=0,ncol=1,prop=myfont)
    plt.grid(True)
    plt.gcf().autofmt_xdate()
    plt.show()
    
def drawb1(dfx):
    myfont = FontProperties(fname='/usr/share/fonts/truetype/arphic/ukai.ttc',size=24)  
    fig=plt.figure(figsize=(48,12), dpi=250)
    p1=fig.add_subplot(1,1,1)
    p1.set_xticklabels(dfx['date'], rotation=15, fontsize='small',fontproperties=myfont)

    #Display data.
    p1.plot(dfx['date'],dfx['balance'],color='blue',linewidth=3,label='Balance [new diagnosis-(New cure+New death)]')

    plt.title(u'National cases(COVID-2019)Increase / decrease quantity balance-2020 Year 01-02 month,Data source: http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml',fontproperties=myfont) 
    plt.legend(loc=0,ncol=1,prop=myfont)
    plt.grid(True)
    plt.gcf().autofmt_xdate()
    plt.show()

 

Balance of the number of cases in China (COVID-2019) - January February 2020

drawb(china)

drawb1(china)

Tags: Big Data Python JSON github Programming

Posted on Wed, 19 Feb 2020 13:15:43 -0500 by itpvision