Making Your First Chart — Visualizing Data
Learn how to turn boring numbers into beautiful charts that tell a story, using Python and simple visualization libraries.
Why Visualize Data?
Your First Bar Chart with matplotlib
import matplotlib.pyplot as plt
# Data: favorite ice cream flavors in our class
flavors = ['Chocolate', 'Vanilla', 'Strawberry', 'Mint', 'Cookie Dough']
votes = [12, 8, 6, 9, 11]
# Create a bar chart
plt.figure(figsize=(8, 5))
plt.bar(flavors, votes, color=['#8B4513', '#F5DEB3', '#FF69B4', '#98FB98', '#DEB887'])
plt.title('Favorite Ice Cream Flavors in Our Class')
plt.xlabel('Flavor')
plt.ylabel('Number of Votes')
plt.show()A Line Chart Showing Change Over Time
import matplotlib.pyplot as plt
# Data: coding practice hours per month
months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun']
hours = [5, 8, 12, 10, 18, 22]
# Create a line chart
plt.figure(figsize=(8, 5))
plt.plot(months, hours, marker='o', color='#4CAF50', linewidth=2)
plt.title('My Coding Practice Hours')
plt.xlabel('Month')
plt.ylabel('Hours')
plt.grid(True, alpha=0.3)
plt.show()The most common mistake in data visualization is making charts too complicated. The best charts are simple and tell ONE clear story. Use clear titles, label your axes, and do not use more than 5-6 colors. If someone cannot understand your chart in 5 seconds, simplify it.
Using the CSV data you created in the last lesson (or new data), create two different charts: a bar chart and a line chart. Ideas: chart your screen time by day of the week, compare ratings of your favorite movies, or track how many pages you read each day. Try changing the colors, adding a title, and labeling the axes. Which chart type tells the story better for your data?
Ready to build?
Put what you learned into practice — pick a project and start coding.
Start Building Free