#!/usr/bin/env python3 # Data extracted manually from # http://www.nhc.gov.cn/yjb/pzhgli/new_list.shtml # (which Wikipedia cites as a primary source) # with considerable help from Google Translate. # Please check! # "Severe cases" reported by China NHC. data = ( (24,237), # 24 January---end of the day, 24:00? (25,324), (26,461), (27,976), (28,1239), (29,1370), (30,1527), (31,1795), # 31 January (32,2110), # 1 February (33,2296), (34,2788), (35,3219), (36,3859), (37,4821), (38,6101), (39,6188), (40,6484), (41,7333), (42,8204), (43,8030), (44,10204), (45,10152), (46,11272), (47,10644), (48,11741), (49,11971), (50,11864), (51,11633), (52,11477), (53,10968), (54,9915), (55,9126), (56,8552), (57,8346), (58,7952), (59,7664), (60,7365), # 29 February (61,7110), # 1 March (62,6806), (63,6416), (64,5952), (65,5737), (66,5489), (67,5264), (68,5111), (69,4794), (70,4492), (71,4180), (72,4020), (73,3610), (74,3226), (75,3032), (76,2830), (77,2622), (78,2314), (79,2136), (80,1963), (81,1845), (82,1714), (83,1573), (84,1399), (85,1235), (86,1034), (87,921), (88,742), ) import datetime xmin = datetime.datetime(2020,1,1) xmax = datetime.datetime(2020,1,1)+datetime.timedelta(days=121) days = [xmin+datetime.timedelta(days=x) for x,y in data] import matplotlib.pyplot as plt import matplotlib.dates as mdates from matplotlib.backends.backend_pdf import PdfPages fig, ax = plt.subplots() fig.set_size_inches(8,2.5) ax.set_xlim([xmin,xmax]) ymax = 1.2*max(y for x,y in data) ax.set_ylim([0,ymax]) plt.fill_between(days,[ymax for x,y in data],color='lightblue') plt.tick_params(axis='y',labelcolor='red',labelleft=False,labelright=True) plt.plot(days,[y for x,y in data],color='red') ax.xaxis.set_major_locator(mdates.MonthLocator()) ax.xaxis.set_major_formatter(mdates.DateFormatter('%b')) plt.setp(ax.get_xticklabels(),rotation=90) fig.tight_layout() with PdfPages('nhc.pdf') as pdf: pdf.savefig() plt.close()