In this Matplotlib example, I am going to create a scatter chart that shows the quantity and the type of shoes I have sold recently. The scatter chart below will show dots that represent the quantity of each type of shoe that I have sold recently.
The program is as follows:-
import matplotlib.pyplot as plt brand = ['Slipper', 'High Heel', 'Sports Shoe'] quantity = [20, 30, 60] plt.figure(figsize=(6, 3), facecolor="brown", edgecolor="red") plt.subplot(3,1,(1, 2)) plt.scatter(brand, quantity) plt.suptitle('Sale of Shoes') plt.show()
The ‘figsize’ parameter of the plt.figure(figsize=(6, 3)) function is used to specify the size of the chart.
Play around with the parameters within the subplot function to plot the best chart as you wish.
The suptitle function will display the title of the chart.
Run the above Matplotlib program to get the above outcome.