求助:
我想要在boxplot上添加一条连接各组中位数的线,那么如何确定各组在x轴上的坐标?
boxplot(len ~ dose, data = ToothGrowth,
subset = supp == "VC", col = "yellow",
main = "Guinea Pigs' Tooth Growth",
xlab = "Vitamin C dose mg",
ylab = "tooth length",
xlim = c(0.5, 3.5), ylim = c(0, 35), yaxs = "i",
boxwex = 0.0001, staplewex =800
)
#a <- locator(3)
lines(a$y~ a$x,type= "l")
代码中我用最原始的办法确定各组中位数的坐标:locator函数,不知道有没有其他的办法确定中位数的坐标,或是横坐标(纵坐标非常容易求出)
谢谢大家!


雷达卡




京公网安备 11010802022788号







