top of page

How to Create Radar Charts in R

Writer's picture: Bernard KilonzoBernard Kilonzo
hands typing on keyboard

Overview

Radar charts, also known as spider charts or web charts, are a type of graphical method used to display multivariate data in the form of a two-dimensional chart. Each variable is represented on a separate axis that starts from the same point in the center of the chart. The relative position and angle of the axes are typically uninformative, but the shape of the resulting polygon can give insights into the data patterns. Radar charts are particularly useful for comparing the performance of different entities on various metrics, making them a popular choice in fields like sports statistics, performance analysis, and market research.

Radar Chart in R with ggradar Package

To create radar chart with the ggradar package, first install and load all the necessary packages in your R session.

installing packages in r session

Set the working directory and load the dataset as shown below.

setting working directory and loading dataset

View the sample dataset.

sample dataset

Let’s create a radar chart using the code below – positioning the legend at the bottom of the view.

creating radar chart

Executing the above code generates the view below.

sample radar chart

Let’s format the chart by defining new colors, adjust the size of labels and texts, as well as the width of the lines and points and change the background color to white using the code below.

code for customizing radar chart in r

Executing the above code generates the view below.

final radar chart created and customized in r

Radar Chart in R with fmsb Package

Install and load the fmsb package as shown below.

installing and loading fmsb package in r

Load the dataset as shown below.

loading sample dataset in r session

Preview the sample dataset.

sample dataset

Note: The first row represents the maximum value of the data (1) while the second row represents the minimum value of the data (0), the rest of rows represent the values for different groups being compared i.e., ML Engineers, Data Engineers, Data Scientists and Data Analysts.

Create a sample radar chart using the code below.

creating a basic radar chart with fmsb package

Executing the above code generates the view below.

sample radar chart

Let’s customize the view, by defining new colors for the lines and areas as follows.

code defining colors for the radar chart

Formatting the chart by changing the grid line type, the grid line color, the line and area colors, as well as the width of each line and the size of labels using the code below.

formatting the radar chart to improve readability

Executing the above code generates the view below.

sample radar chart create with fmsb package

Let’s add a legend at the bottom right section of the view using the code below.

adding legend to the radar chart

Executing the above code adds a legend at the bottom right section as shown below.

final view of the radar chart created with fmsb package in r

Conclusion

Radar charts are versatile and insightful tool for visualizing multivariate data. With the help of packages like ggradar and fmsb, creating radar charts in R becomes a streamlined process, allowing analysts to effectively compare and contrast different data sets. Whether for sports statistics, performance metrics, or market research, radar charts can reveal patterns and insights that might otherwise remain hidden in traditional graphs, making them an essential addition to any data visualization toolkit.

If you like the work we do and would like to work with us, drop us an email on our contacts page and we’ll reach out!

Thank you for reading!

Original.png

We Support You Deliver Business-Focused Solutions That Enable Data-Driven Decision Making.

  • Tableau profile
  • YouTube
  • White LinkedIn Icon
  • Facebook
  • X

QUICK LINKS

CONTACT US

+254 738 307 495

East Gate Mall, Donholm

3rd Floor Suite No. 3i

Nairobi, Kenya

Join our mailing list

bottom of page