Covid19 Visualisation using MatplotLib

A new Python library which tells the COVID-19 related information (country-wise) and it show that how many cases of confirmed, active, deaths, recovered found in that particular Country.

Requiement:

You have python package named COVID and python >= 3.6

Installation:

pip install covid

Covid19 Visualisation using MatplotLib:

import covid
import matplotlib.pyplot as plt
#CREATING INSTANCE
cov = covid.Covid()
#GENERATING DATA
name = input(‘enter the country name ‘)
virusdata = cov.get_status_by_country_name(name)
#ACTIVE
active = virusdata[‘active’]
#RECOVERED
recover = virusdata[‘recovered’]
#DEATHS
deaths = virusdata[‘deaths’]
#PLOTTING THE PIE PLOT
plt.pie([active,recover,deaths],labels=[‘active’,‘recovered’,‘deaths’],
colors = [‘b’,‘g’,‘r’],explode=(0,0,0.2),
startangle = 180,autopct = ‘%1.1f%%’,shadow=True)
#DISPLAYING THE PLOT
plt.title(name)
plt.legend()
plt.show()

Reference:

Leave a Reply

Your email address will not be published. Required fields are marked *