Learn to Create a Radar in R With From Our World in Data (2018)

© 2021 SAGE Publications, Ltd. All Rights Reserved. This PDF has been generated from SAGE Research Methods Datasets. SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization Learn to Create a Radar Chart in R With Data From Our World in Data (2018)

Student Guide

Introduction This guide explores creating a radar chart that compares energy consumption by type across a chosen set of countries. Radar are used to visualize and compare the distribution of quantitative values across a series of categories. The radar chart uses primarily marker distance from the axis to encode value, even though the most striking visual components of the output are irregular shapes with variable surface area.

The visualization in this tutorial (Figure 1) uses data from Our World in Data. The individual point locations represent values across a series of different energy source categories, whereas the subsequent filled area created between these points does not directly encode value as such .

The charts show data for three countries. The data from the chart, in the decreasing order of the source quantity, are as follows.

Estonia: 77 terawatt-hours

• Coal • Oil • Natural gas

Page 2 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization Latvia: 37 terawatt-hours

• Oil • Natural gas • Hydropower

Lithuania: 64 terawatt-hours

• Oil • Natural gas • Coal

Text under the charts reads, “Source: Our World in Data, 2018.”

Figure 1. A Radar Chart

What Is a Radar Chart? The radar chart maps three or more different quantitative variables across a series of categories at equal intervals along a circle. The quantity in each category is marked by a marker plotted a certain distance away from the central axis, which is then connected sequentially to the other category value markers to create a

Page 3 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization unique shape, which can be either filled or unfilled. The angles between the points only represent qualitative distinctions, and the overall shape and surface area depend largely on the arrangement of the categories—therefore not actually encoding total value across categories, though it may at first glance seem to do so. Only the distance of each marker from its origin encodes value, and comparisons between categories are similarly based solely on this distance. Radar charts can be compared side-by-side provided that the axes’ maximum and minimum values are identical across the board.

Values should preferably be percentages, but quantitative values will also suffice provided that there are no significantly outlying values in the dataset. Negative values and axes starting from anything other than zero are generally not recommended, as they render the charts considerably more challenging for the reader to comprehend.

Sometimes, the radar chart type is also called a spider or web chart due to its resemblance to a spider’s web. The term radar chart is often used interchangeably and confused with the polar chart, which for our purposes is an altogether different chart type, showing quantitative variables using a line drawn on a polar coordinate system. One variable (typically time) is mapped to the angle (theta, Θ), and the other variable to the radius (r) (Figure 2).

The polar chart shows weeks 1 through 52, in increments of 4, along the edge and from 0 to 450 in increments of 75 from the center to the edge. All data are approximate. For all years, the number of deaths fluctuated at 100 between weeks 16 and 48. In 2015, the number of deaths increased to 225 in week 4 and then decreased. In 2016, the number of deaths was at 150 between weeks 1 and 12 and then decreased. In 2017, the number of deaths was at 240 in week 2 and then decreased. In 2019, the number of deaths was at 450 in week 1 and then decreased. Text under the chart reads, “Source: NCHS 2018.”

Page 4 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization The radar chart lists oil, other renewables, wind, solar, hydropower, nuclear, and coal. The chart shows that Latvia uses the following energy sources in the decreasing order of quantity: Oil, natural gas, and coal. Text under the chart reads, “Our World in Data, 2018.”

Figure 2. Polar Chart (left) and Radar Chart (right)

Why Use a Radar Chart The radar chart is a relatively rarely used chart type, which has the potential to stand out when competing for attention in a crowded media environment, such as in a poster session. Its use should, however, be carefully weighted against the fact that other chart types greatly outperform the radar chart in most use cases, particularly in terms of readers’ accurate assessment of values. The radar chart is best reserved for use as a very general overview of value distribution across a series of categories. It should also be considered that the reader may not be familiar with the radar chart type and may not intuitively understand how to read it.

Page 5 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization

Considerations and Cautions While radar charts may be visually striking, they can be hard to interpret as the reader is tempted to evaluate value based on shapes and surface areas—which in this case are not accurately indicative of underlying value and are inherently more difficult to assess than length, for example.

The chart type is furthermore prone to misleading the reader, as many plotting methods allow the center of the to be set to other values than zero in order to emphasize variation—such as truncating the axis or moving out the zero value to the inner-most gridline. It is recommended as much as possible to set the zero value in the dead center and clearly mark whenever this is not the case.

It is furthermore recommended to label the grid and/or the value markers themselves whenever possible, though sadly most methods of generating radar charts do not do this by default and require some excess amount of coding or editing outside of the programming environment.

It is possible, though not necessarily advisable, to plot several sets on one background grid. In such cases, it is best to use a qualitative color scheme to distinguish each set and semi-transparent fill and stroke colors to keep legibility at a maximum. An alternative way to compare different sets is to plot several radar charts side-by-side in a small multiples layout, in which case, the same fill and stroke colors can also be used for all.

Variations and Alternatives As mentioned earlier, the terms radar chart and polar chart are often used interchangeably and resemble each other visually. Here the term polar chart is reserved for a chart which shows quantitative variables using a line drawn on a polar coordinate system so that one variable (typically time) is mapped to the

Page 6 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization angle (theta, Θ) and the other to the radius (r). Theta is usually defined so that a full revolution in the coordinate system corresponds to a time period of fixed length (such as a year or 24 hours). A data variable that remains the same over the plotted time period will thus draw a circle, while a continuously increasing variable draws a spiral (Figure 3).

The polar chart shows weeks 1 through 52, in increments of 4, along the edge and from 0 to 450 in increments of 75 from the center to the edge. All data are approximate. For all years, the number of deaths fluctuated at 100 between weeks 16 and 48. In 2015, the number of deaths increased to 225 in week 4 and then decreased. In 2016, the number of deaths was at 150 between weeks 1 and 12 and then decreased. In 2017, the number of deaths was at 240 in week 2 and then decreased. In 2019, the number of deaths was at 450 in week 1 and then decreased. Text under the chart reads, “Source: NCHS 2018.”

Figure 3. Polar Chart

Page 7 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization

If the original data is in polar coordinates, it should also be drawn on a polar coordinate system. Such applications of polar charts include polar radiation plots for antennae and wind speed and direction charts (wind roses).

Better alternatives for visualizing the types of datasets shown in a radar chart

Page 8 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization might be, for instance, the pictorial unit chart, waffle chart, or stacked .

A pictorial unit chart, also known as a pictogram chart or isotype chart, consists of a variety of shapes or glyphs representing absolute value—for example, where each house symbol represents 100 households. The chosen glyphs can be abstract shapes such as circles or squares, but in most cases, self-explanatory pictograms are used. Generally speaking, pictograms are simple images that resemble and represent an object or concept.

The individual elements can be freely organized on the picture plane, though sometimes also the relative locations of elements convey some information. Grouping elements that belong to the same set into rows of equal width makes the whole considerably easier to visually evaluate.

Pictorial unit charts can be used with many of the same datasets as pie charts or 100% stacked bar charts to present the distribution of parts within a whole. In its most basic form, the pictogram chart can also just represent a single quantity broken up into visual units.

The benefit of the pictogram chart is that it emphasizes the parts that make up a whole, for example, highlighting how many individual units of a certain kind exist within a group of units, while the pie or bar chart is more adept at showing the series of values that make up an amorphous consolidated whole. Pie and donut charts are to some extent more precise, as pictorial unit charts often involve rounding values, but the pie and donut charts are significantly more difficult to visually evaluate due to their reliance on angle and area to encode the value.

The pictorial unit chart can also communicate some additional qualitative information through glyph choice that is usually omitted in other chart types (Figure 4).

The chart consists of a grid with three types of pictorial units for each continent.

Page 9 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization Text reads, “1 unit equals 1,000 terawatt-hours.” The pictorial unit for coal is a solid circle, the pictorial unit is an icon of a wedged flame, and the pictorial unit for oil is an icon of a gas station pump. The data from the chart are tabulated below.

Continent Coal Natural gas Oil

Asia 33 units 8 units 20 units

Europe 4 units 5 units 9 units

North America 4 units 10 units 13 units

Text under the chart reads, “Source: Our World in Data, 2018.”

Figure 4. Pictorial Unit Chart

A type of variant of the pictorial unit chart is the waffle chart, where instead of custom pictograms, the units are represented by rectangles or squares of equal size. Overall, waffle charts are a cell grid of any size, where each cell represents some predefined portion of a whole. Often these are rendered using a 10 × 10 grid where each unit represents 1% of the 100% total, but variants also exist where the number of cells is equal to the chosen total quantity represented, for example. Cells within the grid are colored or shaded to represent a certain portion of a whole and sometimes are displayed in a series of colors to differentiate various subgroups within the whole. Waffle charts are most often unclassified, in that each

Page 10 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization rectangle represents one unit of the whole.

Waffle charts can be used with many of the same datasets as pictorial unit charts, or pie or donut charts to present the distribution of parts within a whole. The benefit of the waffle chart, much like the pictorial unit chart, is that it emphasizes the individual parts that make up a whole (Figure 5).

The chart consists of a grid of colored squares for each continent, each color corresponding to an energy source. Text reads, “1 square = 1,000 terawatt-hours.” The data from the chart are tabulated below.

Continent Coal Natural gas Oil

Asia 33 squares 8 squares 20 squares

North America 4 squares 10 squares 13 squares

Europe 4 squares 5 squares 9 squares

Text under the chart reads, “Source: Our World in Data, 2018.”

Figure 5. A Waffle Chart

Page 11 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization

Page 12 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization A stacked bar chart is also often used to show the subdivision of a total value for data points on a qualitative scale on the vertical axis and is a visualization type familiar to readers. A stacked bar chart can be useful for relatively exact appraisals of differences between totals and giving a good visual overview of how these totals are subdivided into two or more categories. The chart can be rendered either as percentage values in a 100% stacked bar chart or as absolute values where the bar lengths differ by value.

Generally, the horizontal version of a stacked bar chart is not interchangeable with the vertical bar chart, which is used to display and serves as an alternative to the line chart (Figure 6). Occasionally, a might be used on a vertically stacked bar chart if the number of data points is limited (two to four categories).

The horizontal axis ranges from 0% to 100%, in increments of 20. The vertical axis lists regions. The approximate data from the chart are tabulated below.

Text under the chart reads, “Source: Our World in Data, 2020.”

Figure 6. A 100% Stacked Bar Chart

Page 13 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization

Illustrative Example: Energy Consumption by Type in the Baltics (2018) Figure 7 shows a radar chart of energy consumption by type across the three Baltic states in 2018, using data from Our World in Data. Each country’s consumption totals are labeled under the country name, as the radar chart presents this in an otherwise misleading way through the shapes and surface areas created from individual marker points—for example, Lithuania at first seems to have consumed the most, when in fact this distinction belongs to Estonia. The radar chart nevertheless gives a relatively easy at-a-glance impression of which types of energy sources each country consumes, as well as relative amounts within each category. A uniform fill color was used for all countries, as the color in itself does not encode any qualitative or quantitative information.

The charts show data for three countries. The data from the chart, in the decreasing order of the source quantity, are as follows.

Page 14 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization Estonia: 77 terawatt-hours

• Coal • Oil • Natural gas

Latvia: 37 terawatt-hours

• Oil • Natural gas • Hydropower

Lithuania: 64 terawatt-hours

• Oil • Natural gas • Coal

Text under the charts reads, “Source: Our World in Data, 2018.”

Figure 7. A Radar Chart of Energy Consumption in the Baltics

The headline further defines the scope represented in the charts above it.

Page 15 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization

The Data The dataset used in this demonstration is the Global primary energy consumption OWID_WRL dataset from Our World in Data. The dataset comprises primary energy consumption 1965–2018 by continental regions and countries. Primary energy consumption shows how much coal, oil, gas, and other energy are consumed as inputs to the energy system of a country or region, including distribution but excluding energy carriers used for other purposes (such as petroleum for making plastic).

Primary energy consumption is the basic or “raw” form of energy : It does not take into account the inefficiencies of converting fossil fuels to final energy.

The dataset only includes commercially-traded fuels (coal, oil, and gas), nuclear, and modern renewables. Traditional biofuels are not included, which are the primary sources of fuel in much of the developing world.

Interpreting the Chart The data showed that Estonia has consumed the most in terms of total terawatt- hours of energy, and particularly in coal. The chart itself only communicates the vast amount of coal consumed rather than any total consumption value, however, as the arrangement of categorical axes around the circle creates a shape for Estonia with a considerably smaller surface area than one might at first expect. This is one of the main pitfalls of the radar chart, as the reader is tempted to scrutinize the shapes for value based on their surface area, rather than individual data points encoding value in their distance from the central vertex. Similarly, by happenstance, the two energy sources favored by Lithuania are situated so that the resulting shape has the largest surface area, in spite of the actual underlying data. Arguably, leaving the shapes unfilled may create less of a visual impression of a single unit meant for evaluation but this in turn weakens the legibility of the

Page 16 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization chart to some extent.

What the radar chart does present in a succinct way, however, is that Lithuania and Latvia prefer oil and natural gas, while Estonia relies mainly on coal and oil. It is also relatively easy to distinguish that Latvia consumes far less of each energy source, regardless of any surface area misunderstandings. It is also clear from the chart that the three countries use little if any renewable energy sources.

The radar chart is a passable choice for comparing data like this, but as mentioned above, there are many other chart types that arguably better suit the purpose in terms of concept comprehension and accurate value assessment for readers.

Review This dataset example has demonstrated the radar chart, how it can be used, and how it compares to other visualization types for use with similar data. A subset of global energy consumption data from Our World in Data dataset was visualized.

You should know:

• What are radar charts? • What kind of data can a radar chart encode? • When is a radar chart an appropriate visualization choice? • What are the best practices for composing radar charts? • What are the main weaknesses and limitations of this visualization method?

Your Turn You may now proceed to download the sample dataset and walkthrough guide on how to carry out the visualization with the R statistical software. The sample dataset includes a number of interesting variables that can be used to augment the example pictured above. You may, for example, with visualizing a

Page 17 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018) SAGE SAGE Research Methods: Data 2021 SAGE Publications, Ltd. All Rights Reserved. Visualization different subset of countries or continents or styling the charts in new ways.

Page 18 of 18 Learn to Create a Radar Chart in R With Data From Our World in Data (2018)