Adding legend to ggplot

后端 未结 2 717
鱼传尺愫
鱼传尺愫 2021-01-27 06:23

This question is a follow-up to this post: previous post

I have 12 variables, M1, M2, ..., M12, for which I compute certain statistics

2条回答
  •  深忆病人
    2021-01-27 07:03

    library(reshape2)
    df1 <- melt(df, id="model")
    
    levels = seq(0.8, 1.2, 0.05)
    
    ggplot(data=df1) + 
      geom_polygon(aes(x=model, y=value, group=variable, colour=variable), fill = NA) + 
      scale_colour_manual(values=c("a"="blue", "b"="red")) +
      coord_polar() + 
      scale_y_continuous(limits=range(levels), breaks=levels, labels=levels) +
      theme(axis.text.y = element_blank(), axis.ticks = element_blank(), axis.title.x = element_blank(), axis.title.y = element_blank())
    

    enter image description here

提交回复
热议问题