27/11/2022 7:47 pm
Topic starter
2
Write a program to create a horizontal bar chart for india’s medal tally in Olympic 2018
This topic was modified 2 years ago by CodeWithBishal-admin
1 Answer
1
27/11/2022 7:47 pm
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 2 years ago 2 times by CodeWithBishal-admin