diff options
| author | Alex <90010930+ajschofield@users.noreply.github.com> | 2020-07-26 19:59:15 +0100 |
|---|---|---|
| committer | Alex <90010930+ajschofield@users.noreply.github.com> | 2020-07-26 19:59:15 +0100 |
| commit | 26fed2bab4b4e6a086ab7b3e652940ef7d3d60ca (patch) | |
| tree | 22322f0037d368ff56ad16f5fa4adfb12de5cdee | |
| parent | 3280b68f1d09e3133d12ba13fea933e3a8472fae (diff) | |
| download | covid-tracker-2-26fed2bab4b4e6a086ab7b3e652940ef7d3d60ca.tar.gz covid-tracker-2-26fed2bab4b4e6a086ab7b3e652940ef7d3d60ca.zip | |
Added cumulative deaths and cases plots
| -rw-r--r-- | main.py | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -166,8 +166,16 @@ if not os.path.exists(path_to_graphs): with Spinner("Creating and saving the daily cases plot... "): p1 = ggplot(cases, aes(x="Specimen date", y="Daily lab-confirmed cases", group = 1)) + geom_point() + geom_line() + labs(title = "Daily COVID-19 Cases") + scale_x_date(date_breaks = "3 days") + stat_smooth(method='mavg', method_args={'window': 3}, color='cyan', show_legend=True) + stat_smooth(method='mavg', method_args={'window': 7}, color='blue') + theme(axis_text_x=element_text(rotation=45, hjust=1)) - p1.save(filename=('cases_' + str(date_today)),path=path_to_graphs,height=5, width=15, units = 'in', dpi=1000, verbose = False) + p1.save(filename=('cases_daily_' + str(date_today)),path=path_to_graphs,height=5, width=20, units = 'in', dpi=1000, verbose = False) with Spinner("Creating and saving the daily change in deaths plot... "): - p2 = ggplot(deaths, aes(x="Reporting date", y="Daily change in deaths", group = 1)) + geom_point() + geom_line() + labs(title = "Daily change in deaths") + scale_x_date(date_breaks = "3 days") + stat_smooth(method='mavg', method_args={'window': 3}, color='cyan') + stat_smooth(method='mavg', method_args={'window': 7}, color='blue') + theme(axis_text_x=element_text(rotation=45, hjust=1)) - p2.save(filename = ('death_change_' + str(date_today)),path=path_to_graphs,height=5, width=15, units = 'in', dpi=1000, verbose = False)
\ No newline at end of file + p2 = ggplot(deaths, aes(x="Reporting date", y="Daily change in deaths", group = 1)) + geom_point() + geom_line() + labs(title = "Daily Change in Deaths") + scale_x_date(date_breaks = "3 days") + stat_smooth(method='mavg', method_args={'window': 3}, color='cyan') + stat_smooth(method='mavg', method_args={'window': 7}, color='blue') + theme(axis_text_x=element_text(rotation=45, hjust=1)) + p2.save(filename = ('deaths_change_daily_' + str(date_today)),path=path_to_graphs,height=5, width=20, units = 'in', dpi=1000, verbose = False) + +with Spinner("Creating and saving the cumulative cases plot... "): + p3 = ggplot(cases, aes(x="Specimen date", y="Cumulative lab-confirmed cases", group = 1)) + geom_point() + geom_line() + labs(title = "Cumulative Cases") + scale_x_date(date_breaks = "3 days") + theme(axis_text_x=element_text(rotation=45, hjust=1)) + p3.save(filename = ('cumulative_cases_' + str(date_today)),path=path_to_graphs,height=5, width=20, units = 'in', dpi=1000, verbose = False) + +with Spinner("Creating and saving the cumulative deaths plot... "): + p4 = ggplot(deaths, aes(x="Reporting date", y="Cumulative deaths", group = 1)) + geom_point() + geom_line() + labs(title = "Cumulative Deaths") + scale_x_date(date_breaks = "3 days") + theme(axis_text_x=element_text(rotation=45, hjust=1)) + p4.save(filename = ('cumulative_deaths_' + str(date_today)),path=path_to_graphs,height=5, width=20, units = 'in', dpi=1000, verbose = False)
\ No newline at end of file |
