Part 3 - Visualization of casesΒΆ

In this part of the tutorial you can find some of the functions of the * Cases Plot * class, in particular this class inherits the properties of the Matplotlib class.

As usual the first step will be to import the arcovid19 module.

[1]:
import arcovid19 as ac
import matplotlib.pyplot as plt

The next cell performs a cache cleanup, as arcovid19 saves a one-hour chache for every request made to the online database. With this action, we make sure that we are using an updated database.

[2]:
ac.CACHE.clear()
[2]:
2

We loaded the COVID-19 database from Argentina.

[3]:
cases = ac.load_cases()

The plot method shows the trend to date of each of the provinces along with that of Argentina. By default, it shows confirmed cases, but you can also choose to view active, recovered and dead cases.

[4]:
fig, ax = plt.subplots(figsize=(20, 8))
cases.plot(ax=ax, confirmed=False, active=True, recovered=False, deceased=False)
ax.legend(loc=2)
[4]:
<matplotlib.legend.Legend at 0x7f64e33fb400>
../_images/cases_tutorial_parte3_8_1.svg

Then if you are interested in a particular province, you just have to add grate_full_periode and specify the name of the province. If you do not enter the name of any province the tool will show you the cases of Argentina.

[5]:
ax = cases.plot.grate_full_period('Bs As', confirmed=True, active=True, recovered=True, deceased=True)
/home/docs/checkouts/readthedocs.org/user_builds/arcovid19/envs/latest/lib/python3.7/site-packages/ipykernel_launcher.py:1: DeprecationWarning: Call to deprecated method grate_full_period. (use growth_provincia instead) -- Deprecated since version 0.5.
  """Entry point for launching an IPython kernel.
../_images/cases_tutorial_parte3_10_1.svg

Also, if you want to observe the behavior of observations by date, you can use the following graphical representations.

[6]:
cases.plot.time_serie_all()
[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f64e111f208>
../_images/cases_tutorial_parte3_12_1.svg
[7]:
cases.plot.time_serie()
[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f64e0fe2860>
../_images/cases_tutorial_parte3_13_1.svg
[8]:
cases.plot.barplot()
[8]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f64deb142e8>
../_images/cases_tutorial_parte3_14_1.svg
[9]:
cases.plot.boxplot(showfliers=False)
[9]:
<matplotlib.axes._subplots.AxesSubplot at 0x7f64de6e3c88>
../_images/cases_tutorial_parte3_15_1.svg

Finally, at the following link part 3 you will find an updated guide on March 28, 2020, of part 3 of the tutorial.