geom_boxplot with precomputed values

前端 未结 1 541
眼角桃花
眼角桃花 2020-12-01 18:34

In the past, I have been able to create boxplots using ggplot2 by providing the lower whisker, lower quantile, median, upper quantile, and upper whisker along with x-axis la

相关标签:
1条回答
  • 2020-12-01 19:23

    This works using ggplot2 version 0.9.1 (and R 2.15.0)

    library(ggplot2)
    
    DF <- data.frame(x=c("A","B"), min=c(1,2), low=c(2,3), mid=c(3,4), top=c(4,5), max=c(5,6))
    
    ggplot(DF, aes(x=x, ymin = min, lower = low, middle = mid, upper = top, ymax = max)) +
      geom_boxplot(stat = "identity")
    

    enter image description here

    See the "Using precomputed statistics" example here

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