[Solved] Write a program to create a horizontal bar chart for india’s medal tally in Olympic 2018

   RSS

2
Topic starter

Write a program to create a horizontal bar chart for india’s medal tally in Olympic 2018

This topic was modified 1 year ago by CodeWithBishal-admin
1 Answer
1
Topic starter

Code:

import matplotlib.pyplot as plt


info = ["Gold", "Silver", "Bronze", "Total"]


India = [26,20,20,66]


plt.ylabel("Medal Type")
plt.xlabel("Medal Count")
x = range(len(info))
plt.yticks(x,info)
plt.title("India's Medal Tally in CommonWealth 2018")
plt.barh(x,India,color=["Gold","Silver","Brown","Black"])
plt.show()

Output:

 

 

 

This post was modified 1 year ago 2 times by CodeWithBishal-admin