向R中的箱线图添加统计信息表
问题描述:
我在同一个图形上创建了两个箱形图,如下所示。
I have created two boxplots on the same graph, as per code below
a = c(1,1,1,2,2,2,2,2,5,5,5,5,5,6,5,4,7)
b = c(1,1,2,2,2,2,2,2,5,5,5,5,5,6,5,3,8)
boxplot( a
, b
, names = c("Category a", "Category b")
, staplewex = 1
, horizontal = TRUE )
我还要添加重要数据点,Q1中位数等,作为标签或类似于图例的图形汇总表-这样可能吗?
I would like to also add the important data points, Q1 median etc, as labels or as a summary table on the graph similar to a legend - is this possible?
谢谢
答
感谢您对plotrix软件包的帮助!
Thanks for your help the plotrix package works!
install.packages("plotrix")
library(plotrix)
table <- sapply(as.data.frame(cbind(a,b)),summary)
addtable2plot(22,2,table)