Changing the Size
01:14 You may have noticed a few changes from the first example. Instead of lists, you’re now using NumPy arrays. You can use any array-like data structure for the data, and NumPy arrays are commonly used in this kind of application because they enable element-wise operations that are performed efficiently.
The NumPy module is a dependency of Matplotlib, which is why you didn’t need to install it manually. You’ve also used named parameters as input arguments in the function call. The parameters
y are required but all the other parameters are optional.
s denotes the size of the marker. In this example, you use the profit margin as a variable to determine the size of the marker and multiply it by
10 to display the size difference more clearly.
02:02 Onscreen, you can see the scatter plot created by this code. The size of the marker indicates the profit margin for each product. The two orange drinks that sell the most are also the ones that have the highest profit margin. This is good news for the café owner.
Become a Member to join the conversation.