0

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

closed as off-topic by Jeffrey Evans, mkennedy, BERA, Vince, Spacedman Sep 7 '18 at 20:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions relating to general IT or with no clear GIS component, are off-topic here but can be researched/asked at Stack Overflow (software development), Super User (computing hardware and software), Database Administrators (relational databases) and other SE sites" – Jeffrey Evans, mkennedy, BERA, Vince, Spacedman
If this question can be reworded to fit the rules in the help center, please edit the question.

1

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)
)

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

# plot
library(ggplot2)
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() +
  theme_light()+
  scale_color_manual(values= c("yellow", "blue"))+
  scale_fill_manual(values= c("yellow", "blue"))+
  coord_polar()

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.