Libraries & Dataset
Let's start by loading the necessary libraries and create a dataset
- matplotlib: for displaying the plot
- pandas: for data manipulation
- numpy: for data generation
| 1 | 16.036968 |
| 2 | -11.666240 |
| 3 | 8.503309 |
| 4 | 7.816552 |
| 5 | -0.893881 |
Most simple scatter plot
This is a basic scatterplot example made with the scatter() function of Matplotlib. These arguments are passed to the function:
- x : column name to be used for the x axis
- y : column name to be used for the y axis
- data : the dataset to be used
- linestyle : style of the lines between each point
- marker : marker style of the points
Going further
This post explains how to create a scatter plot with Matplotlib.
You might be interested in how to custom markers in scatter plots and how to link title and markers in scatter plots.