Drawing a scatter plot
A scatter plot is one where the information is displayed as dots with X and Y values. They are very useful when presenting data with two dimensions (as opposed to a temporal series seen previously) and to see whether there's any relationship between two variables. In this recipe, we'll display a graph plotting time spent on a website against money spent to see whether we can see a pattern.
Getting ready
We need to install matplotlib
in our virtual environment:
$ echo "matplotlib==3.2.1" >> requirements.txt
$ pip install -r requirements.txt
If you are using macOS, you may get an error like this: RuntimeError: Python is not installed as a framework. See the matplotlib
documentation on how to fix it: https://matplotlib.org/faq/osx_framework.html.
As we're going to be working with data points, we'll use the scatter.csv
file to read the data. This file is available on GitHub at https://github...