[the numbers in yaxis in the plot is not arranged in order while the word in x axis are too close. I am actually scraping wikipedia table for COVID19 cases, so i dont save as csv. i am only ploting it directly from the website.]
my code also below
URL="https://en.wikipedia.org/wiki/COVID19_pandemic_in_Nigeria"
html=requests.get(URL)
bsObj= BeautifulSoup(html.content, 'html.parser')
states= []
cases=[]
active=[]
recovered=[]
death=[]
for items in bsObj.find("table",{"class":"wikitable
sortable"}).find_all('tr')[1:37]:
data = items.find_all(['th',{"align":"left"},'td'])
states.append(data[0].a.text)
cases.append(data[1].b.text)
active.append(data[2].text)
recovered.append(data[3].text)
death.append(data[4].text)
table= ["STATES","ACTIVE"]
tab= pd.DataFrame(list(zip(states,active)),columns=table)
tab["ACTIVE"]=tab["ACTIVE"].replace('\n','', regex=True)
x=tab["STATES"]
y=tab["ACTIVE"]
plt.cla()
plt.bar(x,y, color="green")
plt.xticks(fontsize= 5)
plt.yticks(fontsize= 8)
plt.title("PLOTTERSCA")
plt.show()