Error: no stat called StatHline

后端 未结 1 1361
执念已碎
执念已碎 2021-01-21 22:01

I have a data frame as follows:

variable=c(\"D\",\"D\",\"C\",\"C\",\"C\",\"A\",\"B\",\"B\",\"B\",\"B\")
value=c(80,100,70,68,65,45,33,31,36,32)
Count=as.integer(         


        
相关标签:
1条回答
  • 2021-01-21 22:41

    stat_hline got removed in ggplot2 2.0.0, but never fear; it wasn't really necessary anyway. If you remove the stat argument entirely, it will default to identity, which is fine. (summary can work, too, if you prefer.) You need to change the aes mapping, though, changing yintercept to y to account for the new stat.

    All together,

    ggplot(sumVarVal, aes(variable, value)) +
      geom_point(aes(size = Count), pch=15) + 
      guides(fill=guide_legend(title="New")) + 
      theme(legend.background = element_rect(fill="gray90", size=.5, colour = "black"), 
            legend.text=element_text(size=rel(1.3)), 
            legend.title=element_text(size=rel(1.3), face="plain"), 
            legend.position="bottom", 
            axis.text = element_text(size=rel(1.3)),
            axis.title = element_text(size = rel(1.3))) + 
      labs(x="Learning Outcome", y = "Percentage Grade") + 
      geom_errorbar(width=0.6, colour = "blue", size = 1, aes(ymax=..y.., ymin=..y.., y = mean))
    

    produces

    0 讨论(0)
提交回复
热议问题