KnowledgeBoat Logo
|

Informatics Practices

Navya has started an online business. A list stores the number of orders in last 6 months. Write a program to plot this data on a horizontal bar chart.

PyPlot

2 Likes

Answer

import matplotlib.pyplot as plt
orders = [150, 200, 180, 250, 300, 220]
months = ['January', 'February', 'March', 'April', 'May', 'June']
plt.barh(months, orders)
plt.xlabel('Number of Orders')
plt.ylabel('Month')
plt.title('Number of Orders in Last 6 Months')
plt.show()
Output
Navya has started an online business. A list stores the number of orders in last 6 months. Write a program to plot this data on a horizontal bar chart. Plotting with Pyplot, Informatics Practices Computer Science Sumita Arora Solutions CBSE Class 12

Answered By

1 Like


Related Questions