How to put Values on Boxplot in R for several boxplot in one image

后端 未结 2 805
南笙
南笙 2021-01-16 15:52

I want to plot Delta~Project.Types in R. I have 10 Project Types. I know how to do the boxplot : boxplot(Delta~Project.Types). However, how can I put the fivenum (min, max,

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-16 16:22

    You can add a "legend" to a base R plot that contains what you want like this:

    legend("topright", bty = "n", legend = summary(Delta))
    

    I'm assuming that it's "Delta" that you're running summary() on, so change that as needed. You can modify the appearance of what shows up in the legend using paste(), i.e.

    legend("topright", bty = "n", legend = c(paste("min =", summary(Delta)[1]),
                                         paste("max =", summary(Delta)[2])))
    

    etc.

提交回复
热议问题