Q. Write a program to create a horizontal bar chart for India's medal tally.
Medal tally of Commonwealth games
Country | Gold | Silver | Bronze | Total |
---|---|---|---|---|
Australia | 80 | 59 | 59 | 198 |
England | 45 | 45 | 46 | 136 |
India | 26 | 20 | 20 | 66 |
Canada | 15 | 40 | 27 | 82 |
New Zealand | 15 | 16 | 15 | 46 |
South Africa | 13 | 11 | 13 | 37 |
Wales | 10 | 12 | 14 | 36 |
Scotland | 9 | 13 | 22 | 44 |
Nigeria | 9 | 9 | 6 | 24 |
Cyprus | 8 | 1 | 5 | 14 |
Answer :-
import matplotlib.pyplot as plt Info = ['Gold', 'Silver', 'Bronze', 'Total'] India = [26, 20, 20, 66] plt.ylabel("Medal type") plt.xlabel("Medal count") plt.title("India's Medal Tally in Commonwealth 2018") X = range (len (Info)) plt.barh(X, India, color = ['gold', 'silver', 'brown', 'black']) plt.show()
Output :-
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )