Quantity of Fruits¶

In [17]:
import matplotlib.pyplot as plt

Get Data

In [18]:
fruits = ['apple', 'blueberry', 'cherry', 'orange']
counts = [40, 100, 30, 55]

Display Bar Chart

In [19]:
fig, ax = plt.subplots()

bar_labels = ['red', 'blue', '_red', 'orange']
bar_colors = ['tab:red', 'tab:blue', 'tab:red', 'tab:orange']

ax.bar(fruits, counts, label=bar_labels, color=bar_colors)

ax.set_ylabel('fruit supply')
ax.set_title('Fruit supply by kind and color')
ax.legend(title='Fruit color')
Out[19]:
<matplotlib.legend.Legend at 0x20c945a4250>
No description has been provided for this image