27/11/2022 6:03 pm
Topic starter
1
Write a program to plot a bar chart to depict the changing weekly onion prices for four weeks. Give appropriate axes labels.
1 Answer
1
27/11/2022 6:04 pm
Topic starter
Code:
import numpy as np import matplotlib.pylab as plt price = [80,70,75,100] x = np.arange(4) plt.title("Weekly Change in Onion Prices") plt.bar(x,price) plt.xticks(x,["Week 1","Week 2", "Week 3", "Week 4"]) plt.xlabel("Weeks") plt.ylabel("Prices") plt.show()
Output:
This post was modified 2 years ago by CodeWithBishal-admin