Histograms and Scatter Plots
Analyzing data distribution.
Histograms and Scatter Plots is a free Learn AI with Python lesson on CoddyKit — lesson 3 of 5. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Learn AI with Python learning path, one of 5 lessons in the course, and your progress syncs across the web and the CoddyKit app.
1
Histograms and Scatter Plots
Histograms and scatter plots are essential tools for analyzing and visualizing data distribution and relationships.
Histograms show the frequency distribution of data, while scatter plots reveal the relationship between two variables.

2
Understanding Histograms
A histogram groups data into bins and shows how frequently each range of values occurs. The height of each bar represents the frequency.
For example, a histogram can show the distribution of ages in a population.
3
Example of a Histogram
Imagine we have the ages of 100 people. A histogram can help us understand how these ages are distributed across different ranges.
4
Understanding Scatter Plots
Scatter plots display data points on a two-dimensional plane. Each point represents a pair of values from two variables.
For example, a scatter plot can show the relationship between study hours and test scores.
5
Example of a Scatter Plot
Consider data showing the number of hours students studied and their test scores. A scatter plot can reveal if there is a positive, negative, or no correlation between these variables.
6
Creating a Histogram in Python
Here's an example of how to create a histogram using Matplotlib:
import matplotlib.pyplot as plt
import numpy as np
data = np.random.normal(50, 10, 100)
plt.hist(data, bins=10, color='blue', alpha=0.7)
plt.title('Histogram Example')
plt.xlabel('Value')
plt.ylabel('Frequency')
plt.show()7
Creating a Scatter Plot in Python
Here's an example of how to create a scatter plot using Matplotlib:
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [10, 20, 25, 30, 50]
plt.scatter(x, y, color='red')
plt.title('Scatter Plot Example')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.show()8
9
Comparing Histograms and Scatter Plots
While histograms show data distribution, scatter plots reveal relationships between two variables. Both are valuable depending on the analysis goal.
10
Summary and Next Steps
In this lesson, we covered:
- The purpose of histograms and scatter plots.
- How to create and analyze them in Python.
Next, we'll learn about heatmaps to visualize correlations and matrices.

Frequently asked questions
Is the “Histograms and Scatter Plots” lesson free?
Yes — the full text of “Histograms and Scatter Plots” is free to read here on the web, and the Learn AI with Python course includes 5 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Learn AI with Python course, upgrade to CoddyKit PRO.
What will I learn in “Histograms and Scatter Plots”?
Analyzing data distribution. You practise Learn AI with Python with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Learn AI with Python?
No prior experience is required. Learn AI with Python on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 5, so you can start here or from the beginning and move at your own pace.
How long does the “Histograms and Scatter Plots” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Learn AI with Python lesson?
Yes. Every Learn AI with Python lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Introduction to Data Visualization
- Line Charts
- Histograms and Scatter Plots
- Heatmaps
- Interactive Visualizations