5 Popular Data Viz Charts & When To Use Them 

6 minutes

Most of us interact with a variety of data visualizations on a daily basis. For example, you might diligently track your physical activity through bar graphs on your smart watch. Perhaps you check your weather app to see how the temperature will fluctuate throughout the day. Or maybe you’re a stickler about budgeting and keep a pie chart of your expenses. All of these types of data visualizations allow you to find the untold stories hidden in data and bring it to life. 

When it comes to creating a data visualization, knowing which type of chart to use is key to effectively and accurately communicating your information and data. Choosing the right chart ultimately depends on your dataset and the question you’re trying to answer, explains Codecademy Senior Curriculum Developer Eva Sibinga. But you also have to be mindful of your audience; data visualizations can help clarify complex subjects and ideas, but you might lose your audience if your chart is packed with too much info or difficult to read

Understanding how and when to use a certain visualization is a valuable skill for anyone who has to tell a story with data — from Business Intelligence Data Analysts who illustrate the patterns and trends in company data, to Marketers and Content Creators who need to prove the effectiveness of their latest campaigns. In our free course Data Visualization with Python, we’ll show you how to make informative, enlightening, and visually engaging data visualizations with industry-standard Python libraries seaborn and matplotlib.

Ahead, we’ll take a look at some of the most popular data visualization charts and break down when you should use them.

Learn something new for free

1. Bar charts

Bar charts use rectangular bars with different heights to represent and compare values and  categories. They’re a great way to visualize data that can be divided into different categories. Say we’re running an ice cream shop, and we want to see which flavors are the most popular. With a bar chart (as seen in the example below), you can easily organize the number of sales for each flavor side-by-side.

This picture depicts a bar graph that illustrates different categories' values with vertical blocks of varying size placed along an x and y axis.

Alternatively, you could also use bar charts to compare sales between different days of the week, different products (cups vs. cones), or even the sales of different team members. Want to get better at creating bar charts? In our practice project Exploring Mushrooms, you’ll create a bar chart that showcases an extensive dataset of mushroom varieties.

2. Line charts

Line charts are common data visualizations that plot data points along continuous lines. You might’ve seen them used by news outlets to help illustrate fluctuations in stock prices or the number of Covid cases in an area. “Line charts are often the perfect option for showing information over time,” Eva says.

Going back to our imaginary ice cream business, say we wanted to take it a step further and see which flavors were the most popular over the past year using a line graph. “So in this case, we might see a line chart that follows a seasonal trend with sales that are lower in the winter and higher in the summer,” Eva says.

This picture depicts a line graph that plots data points on continuous lines along an x and y axis.

3. Pie charts

Continuing with our ice cream shop example, what if we wanted to summarize categorical data, like the sales of different sized containers, top spending categories, or  sales per location? Any of these could be a good opportunity to use a pie chart, because they’re great tools for visualizing the divisions between the parts of a whole.

You might want to shy away from using pie charts if you have a dataset with lots of variables, or you need to precisely illustrate minute differences. “It depends on the dataset,” Eva says. “If the sections are easy to distinguish, and you don’t need somebody to walk away with exact numbers, they’re great. But if you have a lot of information and people need to know this is 15% versus 20%, that’s harder to distinguish.”

This picture depicts a pie chart that visually divides data into segments of a whole.

4. Scatter plots

Sometimes you want to go beyond just the numbers and illustrate the correlations and relationships between variables. For example, say we want to see how the weather affects ice cream sales. Eva suggests using a scatter plot, which distributes data points along a graph that has both an X and Y axis containing continuous numeric variables.

What do you notice? “We might expect a correlation between hotter temperatures and ice cream sales, but a data visualization could help us understand that better, and a scatterplot would be a great choice,” Eva says.

5. Histogram

Lastly, we have histograms, which we can use to measure the distribution of one variable in a dataset, Eva says. Histograms look like bar charts, but there’s a key difference: Histograms help us visualize the frequency of one given variable, whereas a bar chart compares different categories. With a histogram, we could illustrate the number of cones sold over the course of a single day — so our variable would be the number of cones sold, and we could break it down into one-hour intervals, like so:

Check out our practice project Traveling to Acadia if you want more practice with histograms.

Learn more about data visualization

These are just a few examples of the types of data visualizations you can make as you learn to code. If you want to learn more about different types of data visualizations and their best-use cases, check out our free course Data Visualization with Python. Then, if you want to take your skills even further, try building your own data viz project.

Eva suggests building a project around a topic you’re passionate about (whether that’s Beyoncé’s music career or NFL statistics). Having a genuine interest or passion for the topic will help keep you focused and motivated when you’re doing the less-engaging tasks (like rotating axis labels) or stuck on a problem. “If you care about the subject matter, you’re gonna Google it; you’re gonna go to Stack Overflow,” she says. “You’re going to read through the answers and documentation because you want the chart to look good.”

And as you’re creating your project, remember to stick to best data visualization practices. In our course Principles of Data Literacy, you’ll learn more about how color, scale, and labeling affects a data visualization. “Every design choice matters and can either help or hinder your data visualization,” Eva says. If you need help avoiding common pitfalls, check out our list of visualization mistakes to avoid.

Related courses

3 courses

Related articles

7 articles

What Is GRUB in Linux?

5 minutes
By Stephan Miller

GRUB is the application in Linux that runs first and loads and manages the operating system. Explore GRUB’s features & its boot process.