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

Answered By
1 Like
Related Questions
The prices of a stock for 3 months are given. Write a program to show the variations in prices for each month by 3 lines on same line chart. Make sure to add legends and labels. Show grid also.
A distribution data stores about 1000 random number. Write a program to create a scatter chart from this data with varying point sizes.
Given the following set of data :
Weight measurements for 16 small orders of French-fries (in grams). 78 72 69 81 63 67 65 75 79 74 71 83 71 79 80 69Create a simple histogram from the above data.
Given the following set of data :
Weight measurements for 16 small orders of French-fries (in grams). 78 72 69 81 63 67 65 75 79 74 71 83 71 79 80 69Create a horizontal histogram from the above data.