Skip to content

Data Science Tutorials

  • Home
  • R
  • Statistics
  • Course
  • Machine Learning
  • Guest Blog
  • Contact
  • About Us
  • Toggle search form
  • Defensive Programming Strategies in R
    Defensive Programming Strategies in R Machine Learning
  • How to Use “not in” operator in Filter
    How to Use “not in” operator in Filter R
  • ggpairs in R
    ggpairs in R R
  • Algorithm Classifications in Machine Learning
    Algorithm Classifications in Machine Learning Machine Learning
  • Arrange the rows in a specific sequence in R
    Arrange the rows in a specific sequence in R R
  • How to Use the Multinomial Distribution in R
    How to Use the Multinomial Distribution in R? R
  • droplevels in R with examples
    droplevels in R with examples R
  • pheatmap function in R
    The pheatmap function in R R
Radar plot in R

How to create Radar Plot in R-ggradar

Posted on October 21October 21 By Jim 1 Comment on How to create Radar Plot in R-ggradar
Tweet
Share
Share
Pin

How to create Radar Plot in R, The same-named function in the package requires a data frame as input, with the first column containing the names of the groups and each subsequent column containing a variable.

How to create a ggalluvial plot in R? – Data Science Tutorials

set.seed(123)
df <- data.frame(matrix(runif(30), ncol = 10))
df[, 1] <- paste0("G", 1:3)
colnames(df) <- c("Gorup", paste("Var", 1:9))
Gorup     Var 1     Var 2     Var 3     Var 4      Var 5     Var 6     Var 7
1    G1 0.8830174 0.5281055 0.4566147 0.6775706 0.89982497 0.3279207 0.6928034
2    G2 0.9404673 0.8924190 0.9568333 0.5726334 0.24608773 0.9545036 0.6405068
3    G3 0.0455565 0.5514350 0.4533342 0.1029247 0.04205953 0.8895393 0.9942698
      Var 8     Var 9
1 0.6557058 0.5941420
2 0.7085305 0.2891597
3 0.5440660 0.1471136

Simple radar diagram

The function will produce the following graphic if the data frame is passed to it.

Keep in mind that you will need to define the lowest value and the maximum value if the values in your columns are not between 0 and 1. 

How to create a Sankey plot in R? – Data Science Tutorials

Radar chart

# install.packages("devtools")
# devtools::install_github("ricardo-bion/ggradar")
library(ggradar)
ggradar(df)

Chart labels

You can change the labels for each variable and the grid labels using with axis.labels command.

ggradar(df, values.radar = c(0, 0.5, 1),
        axis.labels = paste0("A", 1:9))

How to Add a caption to ggplot2 Plots in R? (datasciencetut.com)

Colors and types of lines

The function offers a number of arguments for altering colours, including those for the background, line, and grid colors.

lcols <- c("#EEA236", "#5CB85C", "#46B8DA")
ggradar(df,
        background.circle.colour = "white",
        axis.line.colour = "gray60",
        gridline.min.colour = "gray60",
        gridline.mid.colour = "gray60",
        gridline.max.colour = "gray60",
        group.colours = lcols)

Artificial Intelligence Examples-Quick View – Data Science Tutorials 

Customize the radar chart color in ggplot2

lcols <- c("#EEA236", "#5CB85C", "#46B8DA")
ggradar(df,
        background.circle.colour = "white",
        gridline.min.linetype = 1,
        gridline.mid.linetype = 1,
        gridline.max.linetype = 1,
        group.colours = lcols)

Customize radar chart lines in ggplot2

The legend’s title and position can both be modified with the legend.position and legend.title argument, respectively.

ggradar(df,
        legend.title = "Group",
        legend.position = "bottom")

How to Use Gather Function in R?-tidyr Part2 (datasciencetut.com)

Remove the legend

gradar(df,plot.legend = FALSE)

Check your inbox or spam folder to confirm your subscription.

Tweet
Share
Share
Pin
R

Post navigation

Previous Post: How to create a ggalluvial plot in R?
Next Post: ggdogs on ggplot2

Related Posts

  • Load Multiple Packages in R
    Load Multiple Packages in R R
  • How to Replace String in Column in R
    How to Replace String in Column using R R
  • How to Calculate Ratios in R
    How to Calculate Ratios in R R
  • The Multinomial Distribution in R
    The Multinomial Distribution in R R
  • Get the first value in each group in R
    Get the first value in each group in R? R
  • How to test the significance of a mediation effect
    How to test the significance of a mediation effect R

Comment (1) on “How to create Radar Plot in R-ggradar”

  1. Skillslash says:
    October 26 at 1:28 pm

    I read your blog. I found it very informative. I am a big fan of your blogs. I feel the blog aligns perfectly with our services. We are providing data science courses with real-work experience which is ideal for those who wish to have a career transition or start a fresh career path in data science along with a 100% job assurance commitment visit our website Data Science Course in pune . These courses are wonderful for professionals.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • About Us
  • Contact
  • Disclaimer
  • Guest Blog
  • Privacy Policy
  • YouTube
  • Twitter
  • Facebook
  • Defensive Programming Strategies in R
  • Plot categorical data in R
  • Top Data Modeling Tools for 2023
  • Ogive Graph in R
  • Is R or Python Better for Data Science in Bangalore

Check your inbox or spam folder to confirm your subscription.

  • Data Scientist Career Path Map in Finance
  • Is Python the ideal language for machine learning
  • Convert character string to name class object
  • How to play sound at end of R Script
  • Pattern Searching in R
  • best books about data analytics
    Best Books to learn Tensorflow Course
  • How to Use the Multinomial Distribution in R
    How to Use the Multinomial Distribution in R? R
  • Predictive Modeling and Data Science
    Predictive Modeling and Data Science Machine Learning
  • Find the Maximum Value by Group in R
    Find the Maximum Value by Group in R R
  • Arrange the rows in a specific sequence in R
    Arrange the rows in a specific sequence in R R
  • How to Get a Job as a Data Engineer
    How to Get a Job as a Data Engineer? R
  • How to use image function in R
    How to use the image function in R R
  • How to Add Superscripts and Subscripts to Plots in R?, The basic syntax for adding superscripts or subscripts to charts in R is as follows:
    How to Add Superscripts and Subscripts to Plots in R? R

Copyright © 2023 Data Science Tutorials.

Powered by PressBook News WordPress theme