How to Create Radar Charts in R?
Last Updated :
28 Feb, 2023
In this article, we are going to see how to create Radar Charts in R Programming Language.
Radar charts are also known as Spider or Web or Polar charts. It is a graphical graph to display multivariate data in form of 2D charts of three or more quantitative variables which are represented on axes starting from the same point
Dataset in use:
Mumbai Tamil Noida Kerala Patna Assam Ranchi Bhopal Delhi Indore
1 39 39 39 39 39 39 39 39 39 39
2 0 0 0 0 0 0 0 0 0 0
3 2 7 5 5 9 18 7 7 10 19
fmsb package is Several utility functions and it has radarchar() methods to create radar chart in R.
To install the package:
install.packages( fmsb )
Creating a Basic Radar chart in R
Here we will display the basic radar chart using radarchart() methods. For this, we will pass the created dataframe.
Syntax: radarchart(df, cglty, cglcol, cglwd, pcol, plwd)
Parameters:
- df is a dataframe
- pcol attributes is used to change the color of the Polygon line.
- plwd attributes is used to increase or decrease the line width of the Polygon.
- cglcol is used to draw color of the net
- cglwd is for net width
Example: Basic Radar Chart
R
data <- as.data.frame(matrix( sample( 2:20 , 10 ,
replace=T) ,
ncol=10))
colnames(data) <- c("Mumbai" , "Tamil" , "Noida" ,
"Kerala" , "Patna", "Assam" ,
"Ranchi" , "Bhopal", "Delhi",
"Indore" )
data <- rbind(rep(39,10) , rep(0,10) , data)
# Library
library(fmsb)
# The default radar chart
radarchart(data)
Output:

Line Color Customization
pcol attributes are used to change the color of the Polygon line.
Example: Line color customization
R
data <- as.data.frame(matrix( sample( 2:20 , 10 ,
replace=T) ,
ncol=10))
colnames(data) <- c("Mumbai" , "Tamil" , "Noida" ,
"Kerala" , "Patna", "Assam" ,
"Ranchi" , "Bhopal", "Delhi",
"Indore" )
data <- rbind(rep(39,10) , rep(0,10) , data)
radarchart(data, pcol = "Green")
Output:

Fill Color into Polygon
pfcol attributes is used to fill the color of the Polygon.
Example: Fill color
R
data <- as.data.frame(matrix( sample( 2:20 , 10 ,
replace=T) ,
ncol=10))
colnames(data) <- c("Mumbai" , "Tamil" , "Noida" ,
"Kerala" , "Patna", "Assam" ,
"Ranchi" , "Bhopal", "Delhi",
"Indore" )
data <- rbind(rep(39,10) , rep(0,10) , data)
# Library
library(fmsb)
radarchart(data, pfcol = "Green")
Output:

Change the line width
plwd attributes is used to increase or decrease the line width of the Polygon.
Example: Change line width
R
data <- as.data.frame(matrix( sample( 2:20 , 10 ,
replace=T) ,
ncol=10))
colnames(data) <- c("Mumbai" , "Tamil" , "Noida" ,
"Kerala" , "Patna", "Assam" ,
"Ranchi" , "Bhopal", "Delhi",
"Indore" )
data <- rbind(rep(39,10) , rep(0,10) , data)
# Library
library(fmsb)
radarchart(data, plwd = 3)
Output:

Grid Features in radarchart
Following attributes are used for Grids:
- cglcol is used to draw the color of the net
- cglty is for get net line type
- axislabcol is for the color of axis labels
- caxislabels is for the vector of axis labels to display
- cglwd is for net width
Example: Grid features
R
data <- as.data.frame(matrix( sample( 2:20 , 10 ,
replace=T) ,
ncol=10))
colnames(data) <- c("Mumbai" , "Tamil" , "Noida" ,
"Kerala" , "Patna", "Assam" ,
"Ranchi" , "Bhopal", "Delhi",
"Indore" )
data <- rbind(rep(39,10) , rep(0,10) , data)
# Library
library(fmsb)
radarchart(data,
cglcol="Blue", cglty=10, axislabcol="grey",
caxislabels=seq(0,20,5), cglwd=0.8)
Output:

Similar Reads
How to Create a Strip Chart in R? In this article, we will be throwing light on the various methodologies to create a strip chart using various functions and its arguments in the R programming language. Method 1:Create a Strip chart of the numeric vector In this approach to create a strip chart of the numeric vector, the user needs
4 min read
How to Create a Population Pyramid in R? In this article, we will discuss how to create a population pyramid in the R Programming Language. A population pyramid is also known as an age-sex pyramid. It helps us to visualize the distribution of a population by age group and sex. It generally takes the shape of a pyramid. In the population py
4 min read
Radar Chart or Spider Chart in Excel Radar Chart is a pictorial representation of multivariate data. Multivariate data analysis in statistics is nothing but dealing with more than one outcome or observations. Radar graphs can be of two dimensions, three dimensions, or more on the basis of the multiple comparable variables used. The var
5 min read
Chart.js Radar Chart Chart.js Radar Chart is used to present the multivariate data in a spider-web-like format, which allows us to properly analyze and compare more than one quantitative variable in parallel. Using the Radar chart we can properly display the patterns and relationships among the various categories, as ea
4 min read
How to embed ggvis interactive charts in RMarkdown The ggvis is an R package that provides a system for creating the interactive data visualizations. RMarkdown is a tool for creating dynamic documents that combine code, text, and output. To embed ggvis interactive charts in RMarkdown,  use the ggvisOutput and renderGgvis functions from the ggvis pa
4 min read