全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
14333 5
2015-01-07
求助:

   我想要在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函数,不知道有没有其他的办法确定中位数的坐标,或是横坐标(纵坐标非常容易求出)

谢谢大家!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2015-1-8 04:39:48
Following your first command:
复制代码

The (horizontal) position of a box plot can be specified using the "at" parameter in the "boxplot" function which, according to the documentation, "defaults to 1:n where n is the number of boxes".
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-8 08:57:46
zhangyangsmith 发表于 2015-1-8 04:39
Following your first command:

The (horizontal) position of a box plot can be specified using the  ...
Thanks a lot ! It work!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-8 09:11:01
zhangyangsmith 发表于 2015-1-8 04:39
Following your first command:

The (horizontal) position of a box plot can be specified using the  ...
I understood now ! The the (horizontal) position of a box plot just the indexes of the boxes !
Finally!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-8 09:11:07
zhangyangsmith 发表于 2015-1-8 04:39
Following your first command:

The (horizontal) position of a box plot can be specified using the  ...
I understood now ! The the (horizontal) position of a box plot just the indexes of the boxes !
Finally!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2015-1-8 10:15:55
fivenum()
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群