Create Scatter Plot from Data Table

Joan Jul 01, 2026

Data visualization is a powerful tool in understanding and communicating complex data. One of the most effective ways to compare two variables is by using a scatter plot. This type of plot displays values for two variables on a two-dimensional plane, allowing you to identify patterns, trends, and correlations. In this guide, we'll walk you through the process of creating a scatter plot from a data table, using Python and its popular data visualization library, Matplotlib.

a book cover with the title whounit? using data and scatterplots to solve a mystery
a book cover with the title whounit? using data and scatterplots to solve a mystery

Before we dive into the process, ensure you have Python and Matplotlib installed on your system. If not, you can install them using pip, Python's package installer. Run the following commands in your terminal or command prompt:

11 Hands-On Scatter Plot Activities (Free PDF Downloads)
11 Hands-On Scatter Plot Activities (Free PDF Downloads)

Preparing Your Data

First, let's import the necessary libraries and load your data. We'll use a simple CSV file for this example.

Scatter Plot Graphing: How-To Printable
Scatter Plot Graphing: How-To Printable

```python import pandas as pd import matplotlib.pyplot as plt # Load data from CSV file data = pd.read_csv('your_data.csv') ```

Understanding Your Data

Learn How to Create a Scatter Plot in Google Sheets
Learn How to Create a Scatter Plot in Google Sheets

Before creating a scatter plot, it's crucial to understand your data. Use the `head()` function to view the first few rows of your data table.

```python print(data.head()) ```

Selecting Variables for the Scatter Plot

Excel Scatter Plot Tutorial | Step-by-Step Data Visualization Guide for Beginners
Excel Scatter Plot Tutorial | Step-by-Step Data Visualization Guide for Beginners

Choose two variables from your data table that you want to compare. Let's say we're interested in comparing 'Age' and 'Income' from our data table.

```python x = data['Age'] y = data['Income'] ```

Creating the Scatter Plot

an open notebook with writing on it and a graph in the middle that says scatter plots
an open notebook with writing on it and a graph in the middle that says scatter plots

Now that we have our variables, we can create the scatter plot using Matplotlib's `scatter()` function.

```python plt.scatter(x, y) ```

How to Make a Polygon Scatter Plot in Tableau
How to Make a Polygon Scatter Plot in Tableau
Learn to create a scatter plot with two series in Excel - INDZARA
Learn to create a scatter plot with two series in Excel - INDZARA
create scatter plot from data table
create scatter plot from data table
Scatter Plots Activities Practice Worksheets with Line of Best Fit
Scatter Plots Activities Practice Worksheets with Line of Best Fit
Episode 17: 3 Ways to Amp-Up Your Scatter Plot! Featured Data Viz by Maarten Lambrechts — Data Viz Today
Episode 17: 3 Ways to Amp-Up Your Scatter Plot! Featured Data Viz by Maarten Lambrechts — Data Viz Today
Construct and Interpret Real World Scatter Plots Worksheets
Construct and Interpret Real World Scatter Plots Worksheets
Scatter Plot | Grades 6-8 Mathematics Teaching and Lesson Resources
Scatter Plot | Grades 6-8 Mathematics Teaching and Lesson Resources
a printable seating chart for the seats in an event, with numbers and times on it
a printable seating chart for the seats in an event, with numbers and times on it
the printable worksheet for an employee's work schedule is shown in this file
the printable worksheet for an employee's work schedule is shown in this file
Create a Scatter Plot with Matplotlib
Create a Scatter Plot with Matplotlib
How to Create a Scatter Plot in Excel with 3 Variables (with Easy Steps)
How to Create a Scatter Plot in Excel with 3 Variables (with Easy Steps)
3 Steps to Master Scatter Plots in the Classroom
3 Steps to Master Scatter Plots in the Classroom
Scatterplots and Correlation
Scatterplots and Correlation
Simply creating various scatter plots with ggplot #rstats | R-bloggers
Simply creating various scatter plots with ggplot #rstats | R-bloggers
Scatter Plot Practice Worksheet
Scatter Plot Practice Worksheet
Scatter Plot Maker Excel | Scatter Diagram | Correlation Analysis
Scatter Plot Maker Excel | Scatter Diagram | Correlation Analysis
Scatterplot Examples - October 2018 SWD Challenge Recap
Scatterplot Examples - October 2018 SWD Challenge Recap
the scatter plots project is now available for students to learn how to use it
the scatter plots project is now available for students to learn how to use it
Scatter Plot Project with Real World Sports Data
Scatter Plot Project with Real World Sports Data

Customizing the Scatter Plot

To make your scatter plot more informative and visually appealing, you can customize various aspects, such as the title, labels, and colors.

```python plt.title('Age vs Income') plt.xlabel('Age') plt.ylabel('Income') plt.grid(True) plt.show() ```

Adding a Regression Line

To better understand the relationship between the two variables, you can add a regression line to your scatter plot. This line represents the best fit line for the data.

```python from scipy.stats import linregress slope, intercept, r_value, p_value, std_err = linregress(x, y) line = slope * x + intercept plt.plot(x, line, color='red') plt.show() ```

Working with Larger Datasets

When working with larger datasets, you might want to create a scatter plot using only a sample of the data to improve performance.

```python import random # Select a random sample of 100 rows sample = data.sample(n=100) x = sample['Age'] y = sample['Income'] plt.scatter(x, y) plt.show() ```

Creating a Scatter Plot with Seaborn

Seaborn is another powerful data visualization library in Python that provides a more concise and aesthetically pleasing way to create scatter plots.

```python import seaborn as sns sns.scatterplot(x='Age', y='Income', data=data) plt.show() ```

Creating a scatter plot from a data table is a fundamental step in data analysis and visualization. It allows you to explore and communicate the relationship between two variables effectively. By following this guide, you should now be able to create informative and engaging scatter plots using Python and its data visualization libraries. Happy data visualizing!