Complete the code to create a bar chart showing sales for each fruit category.
import matplotlib.pyplot as plt categories = ['Apples', 'Bananas', 'Cherries'] sales = [10, 15, 7] plt.bar([1], sales) plt.show()
We use the list of category names on the x-axis to compare their sales visually.
Complete the code to add labels to the x-axis showing category names.
plt.bar(categories, sales)
plt.xlabel([1])
plt.show()The x-axis label should describe what the categories represent, like 'Fruit Type'.
Fix the error in the code to correctly display the bar chart comparing categories.
plt.bar(categories, [1]) plt.xticks(rotation=45) plt.show()
The heights of the bars must be the sales numbers, not the category names.
Fill both blanks to create a bar chart with category names and sales, and add a title.
plt.bar([1], [2]) plt.title('Sales by [3]') plt.show()
Use categories for x-axis, sales for bar heights, and a descriptive title.
Fill all three blanks to create a bar chart comparing categories with labels and rotated x-axis labels.
plt.bar([1], [2]) plt.xlabel('[3]') plt.xticks(rotation=90) plt.show()
Use categories on x-axis, sales as bar heights, and label the x-axis as 'Fruit Type'.