Use clear charts to discover patterns without overstating what the data proves.
Charts and exploratory analysis
Learning objectives
- Choose a chart that matches a question.
- Label axes and units.
- Identify patterns, gaps, and unusual values.
- Separate observation from explanation.
A first chart
import matplotlib.pyplot as plt
days = ["Mon", "Tue", "Wed", "Thu", "Fri"]
minutes = [20, 35, 25, 40, 30]
plt.bar(days, minutes)
plt.title("Practice time by day")
plt.xlabel("Day")
plt.ylabel("Minutes")
plt.show()
A bar chart compares categories. A line chart is often better for measurements over time, and a histogram shows the shape of a numeric distribution.
Ask before plotting
- What question is this chart meant to answer?
- What does each mark represent?
- Are the axes labeled with units?
- Is the scale honest and readable?
- What can we observe, and what would require more evidence?
Practice
Create a line chart for a robot’s distance readings over ten time steps. Add a horizontal line showing the safety threshold. Include a title and a legend.
Checkpoint
Explain why a chart can be technically correct but still misleading. Name one way a truncated axis can change how a difference appears.
See the Matplotlib user guide for chart types and labeling.