楼主: verbatim
2556 1

[问答] how to make a gap plot? [推广有奖]

  • 1关注
  • 3粉丝

已卖:25份资源

博士生

5%

还不是VIP/贵宾

-

威望
0
论坛币
513 个
通用积分
2.0505
学术水平
0 点
热心指数
2 点
信用等级
0 点
经验
3404 点
帖子
139
精华
0
在线时间
143 小时
注册时间
2006-12-1
最后登录
2020-1-30

楼主
verbatim 发表于 2014-9-4 00:43:14 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

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

经管之家联合CDA

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

感谢您参与论坛问题回答

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

+2 论坛币

DATA0403MODIGRAF4.pdf (57.7 KB)

with the below dataset, the variables are CONCentration, DOSE and TIME. I would like to display dosing information in the gap plots (see attachment).

Dosing records are the records with the variable of DOSE > 0 and variable of CONCentration = NA; concentration records are the records with the variable of CONCentration > 0 and variable of DOSE ='.'  

The only problem on the right panel of the attached gap plot is the first dosing information should be 2.4mg at 167.833hr (see in data), but looks like third dosing record which is 2mg at 23.8333hr in the data to show on the right panel of the gap plot with text() and arrow(). I really don't know how to deal with this with gap.plot. When using gap.plot() to separate the DoseTime, pch only pick single character. Looking forward to your instructions.



  1. [code]
  2. library(plotrix)
  3. gap.plot(data$TIME[data$DOSE=='.'],data$CONC[data$DOSE=='.'], type='b',lty=1,lwd=2, col=2,
  4.     gap.axis='x',gap=c(17,163),
  5.     xtics=c( 0,  10, 160, 165, 170, 175),
  6.     ytics=c(0,  5, 10, 15, 20, 25, 30, 35),
  7.     xlab='Time(hr)',
  8.     ylab='Concentration(ng/ml)',cex=0.9)
  9. Mg <- as.numeric(data$DOSE[data$DOSE > 0])
  10. DoseTime <- as.numeric(data$TIME[data$DOSE > 0])
  11. text(DoseTime, max(data$CONC[!is.na(data$CONC)]),paste(Mg,'mg',sep=''),cex=1,col=2)
  12. arrows(DoseTime, 0.95 * max(data$CONC[!is.na(data$CONC)]),DoseTime, 0.85* max(data$CONC[!is.na(data$CONC)]),col=2,lwd=2,length=0.1,cex=0.2)
复制代码
[/code]

#### data

  1. [/font][/align][align=left][font=Consolas]data = structure(list(CONC = c(NA, 23.9, 30.1, 20.5, 14.3, 6.53, 4.95,
  2. NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 10.8, NA,
  3. 25.2, 24.5, 21.6, 13.5, 8.19, 6.1, NA, NA, NA, NA, NA, NA, NA,
  4. NA, NA, NA, NA, NA), DOSE = c("2", ".", ".", ".", ".", ".", ".",
  5. "1.8", "2", "1.8", "2", "2.4", "2.4", "2.4", "2.4", "2.4", "2.4",
  6. "2.4", "2.4", "2.4", ".", "2.4", ".", ".", ".", ".", ".", ".",
  7. "2.4", "2.4", "2.4", "2.4", "2.4", "2.4", "2.4", "2.4", "2.4",
  8. "2.4", "2.4", "2.4"), TIME = c(0, 0.5, 1, 2, 4.083, 8.167, 12,
  9. 13, 23.833, 37, 49.583, 59.833, 73.667, 83.333, 96.333, 108,
  10. 120.333, 132.333, 144.583, 155.833, 167.75, 167.833, 168.333,
  11. 168.833, 169.833, 171.833, 175.833, 179.833, 179.833, 192.417,
  12. 203.333, 216.333, 228.333, 240.583, 252.833, 263.833, 275.833,
  13. 288.583, 300.583, 336.333)), .Names = c("CONC", "DOSE", "TIME"
  14. ), class = "data.frame", row.names = c("557", "1", "2", "4",
  15. "5", "6", "3", "1109", "558", "11101", "559", "11111", "560",
  16. "1112", "5611", "1113", "547", "1099", "548", "11001", "710",
  17. "549", "1100", "2100", "410", "510", "610", "310", "11011", "550",
  18. "1102", "5511", "1103", "552", "1104", "553", "1105", "554",
  19. "1106", "556"))[/font][/align][align=left][font=Consolas]
复制代码

二维码

扫码加我 拉你入群

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

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

关键词:make plot Gap How Mak display problem records should

已有 1 人评分论坛币 热心指数 收起 理由
hubifeng? + 20 + 2 鼓励积极发帖讨论

总评分: 论坛币 + 20  热心指数 + 2   查看全部评分

沙发
DM小菜鸟 发表于 2015-1-9 20:55:59
感谢分享

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

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