- The Data Visualization Workshop
- Mario D?bler Tim Gro?mann
- 1131字
- 2025-02-21 03:34:52
Comparison Plots
Comparison plots include charts that are ideal for comparing multiple variables or variables over time. Line charts are great for visualizing variables over time. For comparison among items, bar charts (also called column charts) are the best way to go. For a certain time period (say, fewer than 10-time points), vertical bar charts can be used as well. Radar charts or spider plots are great for visualizing multiple variables for multiple groups.
Line Chart
Line charts are used to display quantitative values over a continuous time period and show information as a series. A line chart is ideal for a time series that is connected by straight-line segments.
The value being measured is placed on the y-axis, while the x-axis is the timescale.
Uses
- Line charts are great for comparing multiple variables and visualizing trends for both single as well as multiple variables, especially if your dataset has many time periods (more than 10).
- For smaller time periods, vertical bar charts might be the better choice.
The following diagram shows a trend of real estate prices (per million US dollars) across two decades. Line charts are ideal for showing data trends:
Figure 2.1: Line chart for a single variable
Example
The following figure is a multiple-variable line chart that compares the stock-closing prices for Google, Facebook, Apple, Amazon, and Microsoft. A line chart is great for comparing values and visualizing the trend of the stock. As we can see, Amazon shows the highest growth:
Figure 2.2: Line chart showing stock trends for five companies
Design Practices
- Avoid too many lines per chart.
- Adjust your scale so that the trend is clearly visible.
Note
For plots with multiple variables, a legend should be given to describe each variable.
Bar Chart
In a bar chart, the bar length encodes the value. There are two variants of bar charts: vertical bar charts and horizontal bar charts.
Use
While they are both used to compare numerical values across categories, vertical bar charts are sometimes used to show a single variable over time.
Don’ts of Bar Charts
- Don’t confuse vertical bar charts with histograms. Bar charts compare different variables or categories, while histograms show the distribution for a single variable. Histograms will be discussed later in this chapter.
- Another common mistake is to use bar charts to show central tendencies among groups or categories. Use box plots or violin plots to show statistical measures or distributions in these cases.
Examples
The following diagram shows a vertical bar chart. Each bar shows the marks out of 100 that 5 students obtained in a test:
Figure 2.3: Vertical bar chart using student test data
The following diagram shows a horizontal bar chart. Each bar shows the marks out of 100 that 5 students obtained in a test:
Figure 2.4: Horizontal bar chart using student test data
The following diagram compares movie ratings, giving two different scores. The Tomatometer is the percentage of approved critics who have given a positive review for the movie. The Audience Score is the percentage of users who have given a score of 3.5 or higher out of 5. As we can see, The Martian is the only movie with both a high Tomatometer and Audience Score. The Hobbit: An Unexpected Journey has a relatively high Audience Score compared to the Tomatometer score, which might be due to a huge fan base:
Figure 2.5: Comparative bar chart
Design Practices
- The axis corresponding to the numerical variable should start at zero. Starting with another value might be misleading, as it makes a small value difference look like a big one.
- Use horizontal labels—that is, as long as the number of bars is small, and the chart doesn’t look too cluttered.
- The labels can be rotated to different angles if there isn’t enough space to present them horizontally. You can see this on the labels of the x-axis of the preceding diagram.
Radar Chart
Radar charts (also known as spider or web charts) visualize multiple variables with each variable plotted on its own axis, resulting in a polygon. All axes are arranged radially, starting at the center with equal distances between one another, and have the same scale.
Uses
- Radar charts are great for comparing multiple quantitative variables for a single group or multiple groups.
- They are also useful for showing which variables score high or low within a dataset, making them ideal for visualizing performance.
Examples
The following diagram shows a radar chart for a single variable. This chart displays data about a student scoring marks in different subjects:
Figure 2.6: Radar chart for one variable (student)
The following diagram shows a radar chart for two variables/groups. Here, the chart explains the marks that were scored by two students in different subjects:
Figure 2.7: Radar chart for two variables (two students)
The following diagram shows a radar chart for multiple variables/groups. Each chart displays data about a student’s performance in different subjects:
Figure 2.8: Radar chart with faceting for multiple variables (multiple students)
Design Practices
- Try to display 10 factors or fewer on a single radar chart to make it easier to read.
- Use faceting (displaying each variable in a separate plot) for multiple variables/groups, as shown in the preceding diagram, in order to maintain clarity.
In the first section, we learned which plots are suitable for comparing items. Line charts are great for comparing something over time, whereas bar charts are for comparing different items. Last but not least, radar charts are best suited for visualizing multiple variables for multiple groups. In the following activity, you can check whether you understood which plot is best for which scenario.
Activity 2.01: Employee Skill Comparison
You are given scores of four employees (Alex, Alice, Chris, and Jennifer) for five attributes: efficiency, quality, commitment, responsible conduct, and cooperation. Your task is to compare the employees and their skills. This activity will foster your skills in choosing the best visualization when it comes to comparing items.
- Which charts are suitable for this task?
- You are given the following bar and radar charts. List the advantages and disadvantages of both charts. Which is the better chart for this task in your opinion, and why?
The following diagram shows a bar chart for the employee skills:
Figure 2.9: Employee skills comparison with a bar chart
The following diagram shows a radar chart for the employee skills:
Figure 2.10: Employee skills comparison with a radar chart
- What could be improved in the respective visualizations?
Note
The solution to this activity can be found on page 397.
Concluding the activity, you hopefully have a good understanding of deciding which comparison plots are best for the situation. In the next section, we will discuss different relation plots.