I am a beginner in R language and trying to make this picture. I tried radar. I tried using radarchart (radarchart(data)) but I do not know how to modify the picture.

Here is my data:

A       B      C     D     E     F     G      H      I    Group
-0.61 0.13   0.24  -0.30 -0.12 -1.24  0.74   0.55   0.80   Yellow
1.02  -0.40  0.73  0.17  0.68   1.21  -1.35 -0.84  -1.27   Blue

enter image description here


If your tag is meant for ggplot2 answers.

# data preparation
df = data.frame(Group = LETTERS[1:9],
                Yellow = c(-0.61,0.13,0.24,-0.30,-0.12,-1.24,0.74,0.55,0.80),
                Blue = c(1.02,-0.40,0.73,0.17,0.68,1.21,-1.35,-0.84,-1.27)

df.m <- melt(df, 
               id.vars= c("Group"), 
               measure.vars= c("Yellow", "Blue"),
               variable.name= "Color",
               value.name=    "val"

# plot
ggplot(data=df.m,  aes(x=Group, y=val, group= Color, colour=Color, fill=Color)) + 
  geom_point(size=2) + 
  geom_polygon(size = 1, alpha= 0.2) + 
  ylim(-2.0, 2.0) + ggtitle("Radar")  + 
  scale_x_discrete() +
  scale_color_manual(values= c("yellow", "blue"))+
  scale_fill_manual(values= c("yellow", "blue"))+

enter image description here

In addition to its theme, some aesthetic parameters such as point size (geom_point(size=2)), line thickness (geom_polygon(size = 1)), color (scale_color_manual()) and filling color (scale_fill_manual()) could be useful to modify its look.

  • Thanks alot. Really a big help. is there any way I can (a) indicate 'I' at 12:00 clock position (rotate the circle), (b) fill gray color in pie starting from A to E (like i showed in the picture above)? Thanks alot once again! – nidhi gupta Sep 9 '18 at 20:49
  • @nidhigupta Change the last line to coord_polar(start = pi/9). – Kazuhito Sep 9 '18 at 21:03
  • @nidhigupta As to your (b), I do not have answer but you may create a dummy data vector to represent the gray area. – Kazuhito Sep 9 '18 at 21:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.