Radar Plot Tutorial 5 Data Visualization using R , plotting performance data

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • how to plot radar plot to rank variables or analyse presentation using r programming and fmsb package is explained.
    The radar chart is also known as web chart, spider chart, spider web chart, star chart, star plot, cobweb chart, irregular polygon, polar chart, or Kiviat diagram.
    Script
    #Create data
    library(fmsb)
    fertiliser=c("A","B","C","D","E")
    crops=c("Pisum","Brinjal","Methi","Corn","Kalingad","Kharbooj","Simla","Tomato")
    Fert_A=c(25,37,38,40,50,55,21,48)
    Fert_B=c(45,57,32,35,22,50,32,25)
    max=rep(60,8) # max for each column
    min=rep(20,8) # min for each column
    data=data.frame(rbind(max,min,Fert_A,Fert_B))
    colnames(data)=crops
    basic radar chart
    radar chart color code
    radarchart( data)
    radar chart with grid and polygon colours
    radarchart( data,pcol=c("red","blue"),cglcol="blue")
    adding legend
    legend(x=0.85, y=1, legend = c("Fert_A", "Fert_B"), bty = "n", pch=20 , col=c("red","blue") , text.col = "black", cex=0.9, pt.cex=1.6)
    Adding Colors to webs
    colors_border=c( rgb(0.2,0.5,0.5,0.9), rgb(0.8,0.2,0.5,0.9) )
    colors_in=c( rgb(0.2,0.5,0.5,0.4), rgb(0.8,0.2,0.5,0.4) )
    #Custom the radarChart !
    radarchart( data, axistype=1,
    #custom polygon
    pcol=colors_border , pfcol=colors_in , plwd=4, plty=1 ,
    #custom the grid
    cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,20,5), cglwd=1.1,
    #custom labels
    vlcex=0.8 )

Комментарии • 9

  • @MarciaaMusic
    @MarciaaMusic 2 года назад +2

    You are the greatest teacher ever, this is the second video I have come across from you that has helped me tremendously thank you

    • @DevResearch
      @DevResearch  2 года назад

      Glad I could help! Do watch my other videos also. It motivates me further. You made my day.

  • @haimkichik
    @haimkichik 2 года назад

    Wow, this is neat, clean and all I need.

  • @muhammadazharnadeem2682
    @muhammadazharnadeem2682 4 месяца назад

    What do you mean by Max and min rows in your data?. I have data of more than 150 genotypes for 15 traits. Should I add their max and min values first and then my data?.

    • @DevResearch
      @DevResearch  4 месяца назад

      You need to find out max and min for each trait and use those. These are used to define scale for each trait.

  • @luciagallo6447
    @luciagallo6447 3 года назад

    Hello and thank you very much for the video. I need to stablish the minimun in zero but when I do it, R reads it as "numeric (empty). Could you tell my why this happens? Thank you!

    • @DevResearch
      @DevResearch  3 года назад +1

      Ensure that your data is in dataframe format, where each row is your variable. Therefore gate the dataframe using as.data.frame(rbind(max,min,value))
      your data frame shall look like this
      V1 V2 V3 V4 V5
      max 10 10 10 10 10
      min 5 5 5 5 5
      value1 6 8 7 9 9
      value2 5 6 8 7 6
      Try following code
      #radarplot
      library(fmsb)
      # vectors to get dataframe
      max= rep(10,5)
      min= rep (5,5)
      value=c(6,8,7,9,9)
      #get dataframe
      df= as.data.frame(rbind(max,min,value1))
      df
      colnames(df)= c("A","B","C","D","E") # This is optional
      # plot radarplot
      radarchart(df)

    • @luciagallo6447
      @luciagallo6447 3 года назад

      @@DevResearch thank you!!