7 min read
📊intermediate

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?

Imagine someone gives you a spreadsheet with 1,000 rows of temperature data. Could you spot a trend? Probably not by staring at numbers. But turn those numbers into a line chart, and suddenly you can see: 'Oh! The temperature has been rising every year!' Visualization turns confusing data into clear pictures that anyone can understand. Different chart types tell different stories: - Bar charts compare categories (which flavor is most popular?) - Line charts show change over time (how has temperature changed?) - Pie charts show proportions (what percent of students like each subject?) - Scatter plots show relationships (do taller people run faster?)

Your First Bar Chart with matplotlib

python
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

python
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()
Pro Tip

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.

Chart Your Own Data

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