Robotics & Artificial Intelligence
A company XYZ Ltd. records its monthly sales in lakhs as follows:
Month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
Sales = [25, 30, 28, 35, 40, 38]
Write a Python program using Matplotlib to:
- Store the data.
- Plot a bar chart with month on X-axis and sales on Y-axis.
- Label the axes and give a title "XYZ Ltd. Half-Yearly Sales"
Python Modules
1 Like
Answer
import matplotlib.pyplot as plt
month = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
sales = [25, 30, 28, 35, 40, 38]
plt.bar(month, sales)
plt.xlabel("Month")
plt.ylabel("Sales (in lakhs)")
plt.title("XYZ Ltd. Half-Yearly Sales")
plt.show()
Output

Answered By
1 Like