rradar-chart

ggradar graph doesn't look correct


I'm trying to make a spider/radar graph. Here's my code:

structure(list(Acceptance = c(16, 4, 13), `Committed Action` = c(16, 
4, 11), Diffusion = c(16, 4, 7), `Present Moment` = c(16, 4, 
10), `Self as Context` = c(16, 4, 11), Values = c(16, 4, 12)), row.names = c(NA, 
-3L), class = c("tbl_df", "tbl", "data.frame"))

# DF Structure

Acceptance `Committed Action` Diffusion `Present Moment` `Self as Context` Values
       <dbl>              <dbl>     <dbl>            <dbl>             <dbl>  <dbl>
1         16                 16        16               16                16     16
2          4                  4         4                4                 4      4
3         13                 11         7               10                11     12

Many tutorials said that you should have first row as maximum and the second row as minimum. So that's what I've done.

Now, I make the graph:

radarchart(df, axistype=1,
           #custom polygon
           pcol=rgb(0.2,0.5,0.5,0.9), pfcol=rgb(0.2,0.5,0.5,0.5), plwd=4, 
           #custom the grid
           cglcol="grey", cglty=1, axislabcol="grey", caxislabels=seq(0,16,4), cglwd=0.8,
           #custom labels
           vlcex=0.8 
)

This is what I get:

Radar Graph Output

For instance, Diffusion = 7. But in the radar graph, the value is somewhere around "4" (the first polygon among the concentric polygons. Similarly, Values is 12 but the graph shows value less than 12. How do I correct this? What's happening?


Solution

  • The issue is that you assigned wrong labels, i.e. the inner polygon corresponds to the minimum value of 4, while the outer polygon corresponds to the maximum value of 16. Hence, the correct labels are caxislabels = seq(4, 16, length.out = 5). Or as a second option (and perhaps the result you want to achieve) set the minimum value in your data to zero.

    library(fmsb)
    
    radarchart(df,
      axistype = 1,
      # custom polygon
      pcol = rgb(0.2, 0.5, 0.5, 0.9), pfcol = rgb(0.2, 0.5, 0.5, 0.5), plwd = 4,
      # custom the grid
      cglcol = "grey", cglty = 1, axislabcol = "grey",
      caxislabels = seq(4, 16, length.out = 5), 
      cglwd = 0.8,
      # custom labels
      vlcex = 0.8
    )