楼主: jiangqing001
14404 5

[问答] 如何确定boxplot的横坐标 [推广有奖]

  • 12关注
  • 5粉丝

教授

84%

还不是VIP/贵宾

-

威望
0
论坛币
10488 个
通用积分
332.3109
学术水平
16 点
热心指数
27 点
信用等级
14 点
经验
26280 点
帖子
1923
精华
0
在线时间
1388 小时
注册时间
2011-12-7
最后登录
2024-4-21

楼主
jiangqing001 发表于 2015-1-7 23:58:53 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
求助:

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

谢谢大家!
二维码

扫码加我 拉你入群

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

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

关键词:BOXPLOT plot box 横坐标 Growth 如何

回帖推荐

zhangyangsmith 发表于2楼  查看完整内容

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".

沙发
zhangyangsmith 发表于 2015-1-8 04:39:48
Following your first command:
  1. a <- with(subset(ToothGrowth, supp == "VC"), tapply(len, dose, median))

  2. lines(as.numeric(as.factor(names(a))), a)
复制代码

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".

藤椅
jiangqing001 发表于 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!

板凳
jiangqing001 发表于 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!

报纸
jiangqing001 发表于 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!

地板
512002855 发表于 2015-1-8 10:15:55
fivenum()

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-3 17:53