Changing the Shape
00:00 Changing the shape. The café owner has found this exercise very useful and he wants to investigate another product. In addition to the orange drinks, you’ll now also plot similar data for the range of cereal bars available in the café. In this code, you refactor the variable names to take into account that you now have data for two different products.
01:48 You then plot both scatter plots in a single figure.
02:29 This gives the output seen onscreen. Unfortunately, you can no longer figure out which data points belong to the orange drinks and which to the cereal bars, but you can change the shape of the marker for one of the scatter plots.
02:48
You keep the default marker shape for the orange drink data, and the default marker is "o"
, which represents a dot. For the cereal bar data, you set the marker shape to "d"
, which represents a diamond marker.
03:02 Here, you can see a list of some common markers from the documentation page. Here are the two scatter plots superimposed on the same figure. It’s now easy to distinguish the data points for the orange drinks from those for the cereal bars.
03:20 But this plot is now displaying a common problem with scatter plots, which we’re going to see how to fix in the next section.
Become a Member to join the conversation.