Interactive Scatter Plot
Learn to explore data by creating, moving, and analyzing points in real-time
Try these examples:
Interactive Scatter Plot
Click, drag, and reshape data in real time. Every change recalculates statistics instantly.
How to Interact
- Click the plot to add a point
- Double-click a point to remove it
- Drag any point to reposition it
{input:dataPoints}
Interactive Scatter Plot
Live Statistics
| Statistic | Value |
|---|---|
| Points () | |
| Correlation () | |
Correlation Strength
The Pearson correlation captures both direction and strength of a linear pattern:
- : strong positive trend (drag points into an upward line to see this)
- : strong negative trend
- : no linear pattern
Try dragging a single point far from the cluster and watch =
Regression Line
The best-fit line minimizes squared residuals:
Drag points to reshape the line. Adding an outlier far from the trend pulls both slope (
Experiments
- Perfect line -- arrange points along a diagonal; approaches and =
0.837 nears . - Outlier effect -- load the "Positive Trend" preset, then drag one point far away. Watch =
0.915 drop. - Cluster -- bunch all points together; with little spread the regression line wobbles and =
0.837 becomes unreliable. - Presets -- load each preset above and compare the statistics.
Try it in Code
# Scatter plot with correlation and regression
import numpy as np
import matplotlib.pyplot as plt
x = np.array([2, 4, 6, 8, 10])
y = np.array([3, 5, 4, 7, 8])
r = np.corrcoef(x, y)[0, 1]
slope, intercept = np.polyfit(x, y, 1)
print(f"n = {len(x)}, Mean X = {x.mean():.2f}, Mean Y = {y.mean():.2f}")
print(f"Correlation r = {r:.3f}, R-squared = {r**2:.3f}")
print(f"y = {slope:.3f} * x + {intercept:.3f}")
plt.scatter(x, y)
plt.plot(x, slope * x + intercept, color="green")
plt.show()Inputs
What to explore next
Birthday Paradox
Explore the surprising probability that two people share a birthday
Comparing Distributions with Box Plots
Visualize and compare multiple datasets using box plots and five-number summaries
Correlation Explorer
Visualize and understand correlation strength and direction
Cross-Validation Techniques
Learn k-fold, stratified, and leave-one-out cross-validation for robust model evaluation
You might also like
Normal Distribution Calculator
Calculate z-scores and convert between z-scores and raw values
Correlation Explorer
ExplorationVisualize and understand correlation strength and direction
Linear Regression Explorer
ExplorationUnderstand how least squares regression finds the best-fit line
Back-to-Back Stem-and-Leaf Plots
ExplorationCompare two distributions side-by-side using back-to-back stem-and-leaf plots