使用 ggplot2 增加图形的大小
Increasing size of graph using ggplot2
我想增加下图的大小,使其占据更多页面并更易于阅读。高度没问题,我只想拉伸x轴。
这是我的代码:
pdf("Glucose and Insulin Data.pdf", paper='USr')
library(ggplot2)
library(dplyr)
library(scales)
library(gridExtra)
#get data from Visit 1
carb1<-subset(data1,Visit == 1)
visit1 <- toString(carb1[1,3])
id1 <- toString(carb1[1,1])
date1<- toString(carb1[1,4])
carb1$Amount = as.numeric(as.character(carb1$Amount))
carb1$time = as.POSIXct(carb1$Start, format = "%H:%M", tz = "GMT")
q <- ggplot(data=carb1, aes(x=time, y=Amount, group=Description, color= Description, shape=Type, label=Amount )) + geom_text(data=carb1[carb1$Type=="Insulin (units)", ], size=3, hjust=0, vjust=2, color="black") + geom_bar(data=carb1[carb1$Type=="Carb (grams)", ], stat="identity", width=.1) + geom_point(data=carb1[carb1$Description != "Disconnect or Reconnect Time", ], size=4) + theme(text = element_text(size=10),
axis.text.x = element_text(angle=90, vjust=1)) + scale_y_continuous(breaks = round(seq(0, max(carb1$Amount), by = 50),2)) + xlab("Time (HH:MM)") + ylab("Glucose (mg/dL), Carbohydrates (grams)") + ggtitle(toString(c("Blood Glucose Measurements \n with Carbohydrate and Insulin Administration"))) + geom_bar(data=carb1[carb1$Type=="Disconnect or Reconnect Time", ], width=.1, stat="identity") + scale_x_datetime(breaks=date_breaks("1 hour"), labels= date_format("%H:%M")) + theme_bw() + scale_shape_manual(values=c(16,17,15,18)) + theme(plot.margin = unit(c(0,0,0,0), "cm"))
q
grid.text((paste("Patient ID:", id1, sep = " ")),
x = unit(.922, "npc"), y = unit(.89, "npc"), just = c("right", "top"),
gp = gpar(fontface = "bold", fontsize = 12, col = "black"))
grid.text((paste("Visit:", visit1, sep = " ")),
x = unit(.828, "npc"), y = unit(.85, "npc"), just = c("right", "top"),
gp = gpar(fontface = "bold", fontsize = 12, col = "black"))
grid.text((paste("Date:", date1, sep = " ")),
x = unit(.87 , "npc"), y = unit(.81, "npc"), just = c("right", "top"),
gp = gpar(fontface = "bold", fontsize = 12, col = "black"))
dev.off()
以及 carb1
的数据:
> dput(carb1)
structure(list(EDC.ID. = structure(c(14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L), .Label = c("Subject 1", "Subject 10",
"Subject 11", "Subject 12", "Subject 13", "Subject 14", "Subject 15",
"Subject 16", "Subject 17", "Subject 18", "Subject 19", "Subject 2",
"Subject 20", "Subject 3", "Subject 4", "Subject 5", "Subject 6",
"Subject 7", "Subject 8", "Subject 9"), class = "factor"), Subject.ID.. = c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), Visit = c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L), Date = structure(c(12L, 12L, 12L, 12L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L), .Label = c("-", "10/1/14", "10/3/14", "10/7/14",
"8/14/14", "8/18/14", "8/19/14", "8/20/14", "8/21/14", "8/25/14",
"8/27/14", "8/28/14", "9/1/14", "9/10/14", "9/12/14", "9/15/14",
"9/16/14", "9/18/14", "9/19/14", "9/2/14", "9/22/14", "9/23/14",
"9/24/14", "9/25/14", "9/26/14", "9/29/14", "9/3/14", "9/30/14",
"9/4/14", "9/5/14", "9/8/14", "9/9/14"), class = "factor"), Start = structure(c(218L,
116L, 361L, 420L, 487L, 508L, 521L, 535L, 13L, 63L, 78L, 111L,
125L, 184L, 204L, 274L, 302L, 331L, 361L, 391L, 420L, 443L, 73L,
202L, 290L), .Label = c("0:16", "1:25", "10:00", "10:01", "10:02",
"10:03", "10:04", "10:05", "10:06", "10:07", "10:08", "10:09",
"10:10", "10:11", "10:12", "10:13", "10:14", "10:15", "10:16",
"10:17", "10:18", "10:19", "10:20", "10:21", "10:22", "10:23",
"10:24", "10:25", "10:26", "10:27", "10:28", "10:29", "10:30",
"10:31", "10:32", "10:33", "10:34", "10:35", "10:36", "10:37",
"10:38", "10:39", "10:40", "10:41", "10:42", "10:43", "10:44",
"10:45", "10:46", "10:47", "10:48", "10:49", "10:50", "10:51",
"10:52", "10:53", "10:54", "10:55", "10:56", "10:57", "10:58",
"10:59", "11:00", "11:01", "11:02", "11:03", "11:04", "11:05",
"11:06", "11:07", "11:08", "11:09", "11:10", "11:11", "11:12",
"11:13", "11:14", "11:15", "11:16", "11:17", "11:18", "11:19",
"11:20", "11:21", "11:22", "11:23", "11:24", "11:25", "11:26",
"11:27", "11:28", "11:29", "11:30", "11:31", "11:33", "11:34",
"11:35", "11:36", "11:37", "11:38", "11:39", "11:40", "11:41",
"11:42", "11:43", "11:44", "11:45", "11:46", "11:47", "11:48",
"11:49", "11:50", "11:51", "11:52", "11:53", "11:54", "11:55",
"11:56", "11:57", "11:58", "11:59", "12:00", "12:01", "12:03",
"12:04", "12:05", "12:06", "12:07", "12:08", "12:09", "12:10",
"12:11", "12:12", "12:13", "12:14", "12:15", "12:16", "12:18",
"12:19", "12:20", "12:21", "12:22", "12:23", "12:24", "12:25",
"12:26", "12:27", "12:28", "12:29", "12:30", "12:31", "12:32",
"12:33", "12:34", "12:35", "12:36", "12:37", "12:38", "12:39",
"12:40", "12:41", "12:42", "12:43", "12:44", "12:45", "12:46",
"12:47", "12:48", "12:49", "12:50", "12:51", "12:52", "12:53",
"12:54", "12:55", "12:56", "12:57", "12:58", "12:59", "13:00",
"13:01", "13:03", "13:04", "13:05", "13:06", "13:07", "13:08",
"13:09", "13:10", "13:11", "13:12", "13:13", "13:14", "13:15",
"13:16", "13:17", "13:18", "13:19", "13:20", "13:21", "13:22",
"13:23", "13:24", "13:25", "13:27", "13:28", "13:29", "13:30",
"13:31", "13:32", "13:33", "13:34", "13:35", "13:36", "13:37",
"13:38", "13:39", "13:40", "13:41", "13:42", "13:44", "13:45",
"13:46", "13:47", "13:48", "13:49", "13:50", "13:51", "13:52",
"13:53", "13:54", "13:55", "13:56", "13:57", "13:58", "13:59",
"14:00", "14:01", "14:02", "14:03", "14:04", "14:05", "14:06",
"14:08", "14:09", "14:10", "14:11", "14:12", "14:14", "14:15",
"14:16", "14:17", "14:18", "14:19", "14:20", "14:21", "14:22",
"14:23", "14:24", "14:25", "14:26", "14:27", "14:28", "14:29",
"14:30", "14:31", "14:33", "14:34", "14:35", "14:36", "14:37",
"14:38", "14:39", "14:40", "14:41", "14:42", "14:43", "14:44",
"14:45", "14:46", "14:48", "14:49", "14:50", "14:51", "14:52",
"14:53", "14:54", "14:55", "14:57", "14:58", "14:59", "15:00",
"15:01", "15:02", "15:03", "15:04", "15:05", "15:06", "15:07",
"15:08", "15:09", "15:10", "15:12", "15:13", "15:14", "15:15",
"15:16", "15:17", "15:18", "15:19", "15:20", "15:21", "15:22",
"15:23", "15:24", "15:25", "15:26", "15:27", "15:28", "15:29",
"15:30", "15:31", "15:32", "15:33", "15:34", "15:35", "15:36",
"15:37", "15:38", "15:39", "15:40", "15:41", "15:42", "15:43",
"15:44", "15:45", "15:46", "15:47", "15:48", "15:49", "15:50",
"15:51", "15:52", "15:53", "15:54", "15:55", "15:56", "15:57",
"15:58", "15:59", "16:00", "16:01", "16:02", "16:03", "16:04",
"16:05", "16:06", "16:07", "16:08", "16:09", "16:10", "16:11",
"16:12", "16:13", "16:14", "16:15", "16:16", "16:17", "16:18",
"16:19", "16:20", "16:21", "16:22", "16:23", "16:24", "16:25",
"16:26", "16:27", "16:28", "16:29", "16:30", "16:31", "16:32",
"16:33", "16:34", "16:35", "16:36", "16:37", "16:38", "16:39",
"16:40", "16:42", "16:43", "16:44", "16:45", "16:46", "16:47",
"16:48", "16:49", "16:50", "16:51", "16:52", "16:53", "16:54",
"16:55", "16:56", "16:57", "16:58", "16:59", "17:00", "17:01",
"17:02", "17:03", "17:04", "17:05", "17:06", "17:07", "17:08",
"17:09", "17:10", "17:11", "17:12", "17:14", "17:15", "17:17",
"17:18", "17:19", "17:20", "17:21", "17:22", "17:23", "17:24",
"17:25", "17:26", "17:29", "17:30", "17:32", "17:34", "17:35",
"17:36", "17:38", "17:39", "17:40", "17:45", "17:50", "17:51",
"17:54", "18:09", "18:15", "2:40", "21:24", "21:27", "21:39",
"3:48", "7:51", "8:00", "8:04", "8:05", "8:10", "8:14", "8:15",
"8:18", "8:26", "8:29", "8:31", "8:33", "8:37", "8:39", "8:40",
"8:41", "8:43", "8:44", "8:45", "8:47", "8:48", "8:50", "8:51",
"8:52", "8:54", "8:55", "8:56", "8:57", "8:58", "8:59", "9:00",
"9:01", "9:02", "9:03", "9:04", "9:05", "9:06", "9:07", "9:08",
"9:09", "9:11", "9:12", "9:13", "9:14", "9:15", "9:17", "9:18",
"9:19", "9:20", "9:21", "9:22", "9:23", "9:24", "9:25", "9:27",
"9:28", "9:29", "9:30", "9:32", "9:33", "9:34", "9:35", "9:36",
"9:37", "9:38", "9:39", "9:40", "9:42", "9:43", "9:44", "9:45",
"9:46", "9:47", "9:48", "9:49", "9:50", "9:51", "9:52", "9:53",
"9:54", "9:55", "9:56", "9:57", "9:58", "9:59"), class = "factor"),
End = structure(c(240L, 114L, 360L, 419L, 496L, 517L, 529L,
543L, 13L, 62L, 76L, 109L, 123L, 182L, 202L, 273L, 301L,
330L, 360L, 390L, 419L, 444L, 190L, 260L, 457L), .Label = c("0:16",
"1:25", "10:00", "10:01", "10:02", "10:03", "10:04", "10:05",
"10:06", "10:07", "10:08", "10:09", "10:10", "10:11", "10:12",
"10:13", "10:14", "10:15", "10:16", "10:17", "10:18", "10:19",
"10:20", "10:21", "10:22", "10:23", "10:24", "10:25", "10:26",
"10:27", "10:28", "10:29", "10:30", "10:31", "10:32", "10:33",
"10:34", "10:35", "10:36", "10:37", "10:38", "10:39", "10:40",
"10:41", "10:42", "10:43", "10:44", "10:45", "10:46", "10:47",
"10:48", "10:49", "10:50", "10:51", "10:52", "10:53", "10:54",
"10:55", "10:57", "10:58", "10:59", "11:00", "11:01", "11:03",
"11:04", "11:05", "11:06", "11:07", "11:08", "11:09", "11:10",
"11:11", "11:12", "11:13", "11:14", "11:15", "11:16", "11:17",
"11:18", "11:19", "11:20", "11:21", "11:22", "11:23", "11:24",
"11:25", "11:26", "11:27", "11:28", "11:29", "11:30", "11:31",
"11:33", "11:34", "11:35", "11:36", "11:37", "11:38", "11:39",
"11:40", "11:41", "11:42", "11:43", "11:44", "11:45", "11:46",
"11:47", "11:48", "11:49", "11:50", "11:51", "11:52", "11:53",
"11:54", "11:55", "11:56", "11:57", "11:58", "11:59", "12:00",
"12:01", "12:03", "12:04", "12:05", "12:06", "12:07", "12:08",
"12:09", "12:10", "12:11", "12:12", "12:13", "12:14", "12:15",
"12:16", "12:18", "12:19", "12:20", "12:21", "12:22", "12:23",
"12:24", "12:25", "12:26", "12:27", "12:28", "12:29", "12:30",
"12:31", "12:32", "12:33", "12:34", "12:35", "12:36", "12:37",
"12:38", "12:39", "12:40", "12:41", "12:42", "12:43", "12:44",
"12:45", "12:46", "12:47", "12:48", "12:49", "12:50", "12:51",
"12:52", "12:53", "12:54", "12:55", "12:56", "12:57", "12:58",
"12:59", "13:00", "13:01", "13:03", "13:04", "13:05", "13:06",
"13:07", "13:08", "13:09", "13:10", "13:11", "13:12", "13:13",
"13:14", "13:15", "13:16", "13:17", "13:18", "13:19", "13:20",
"13:21", "13:22", "13:23", "13:24", "13:25", "13:27", "13:28",
"13:29", "13:30", "13:31", "13:32", "13:33", "13:34", "13:35",
"13:36", "13:37", "13:38", "13:39", "13:40", "13:41", "13:42",
"13:43", "13:44", "13:45", "13:46", "13:48", "13:49", "13:50",
"13:51", "13:52", "13:53", "13:54", "13:55", "13:56", "13:57",
"13:58", "13:59", "14:00", "14:01", "14:02", "14:03", "14:04",
"14:05", "14:06", "14:08", "14:09", "14:10", "14:11", "14:12",
"14:13", "14:14", "14:15", "14:16", "14:17", "14:18", "14:19",
"14:20", "14:21", "14:22", "14:23", "14:24", "14:25", "14:26",
"14:27", "14:28", "14:29", "14:30", "14:31", "14:33", "14:34",
"14:35", "14:36", "14:37", "14:38", "14:39", "14:40", "14:41",
"14:42", "14:43", "14:44", "14:45", "14:46", "14:48", "14:49",
"14:50", "14:51", "14:52", "14:53", "14:54", "14:55", "14:57",
"14:58", "14:59", "15:00", "15:01", "15:02", "15:03", "15:04",
"15:05", "15:06", "15:07", "15:08", "15:09", "15:10", "15:12",
"15:13", "15:14", "15:15", "15:16", "15:17", "15:18", "15:19",
"15:20", "15:21", "15:22", "15:23", "15:24", "15:25", "15:26",
"15:27", "15:28", "15:29", "15:30", "15:31", "15:32", "15:33",
"15:34", "15:35", "15:36", "15:37", "15:38", "15:39", "15:40",
"15:41", "15:42", "15:43", "15:44", "15:45", "15:46", "15:47",
"15:48", "15:49", "15:50", "15:51", "15:52", "15:53", "15:54",
"15:55", "15:56", "15:57", "15:58", "15:59", "16:00", "16:01",
"16:02", "16:03", "16:04", "16:05", "16:06", "16:07", "16:08",
"16:09", "16:10", "16:11", "16:12", "16:13", "16:14", "16:15",
"16:16", "16:17", "16:18", "16:19", "16:20", "16:21", "16:22",
"16:23", "16:24", "16:25", "16:26", "16:27", "16:28", "16:29",
"16:30", "16:31", "16:32", "16:33", "16:34", "16:35", "16:36",
"16:37", "16:38", "16:39", "16:40", "16:42", "16:43", "16:44",
"16:45", "16:46", "16:47", "16:48", "16:49", "16:50", "16:51",
"16:52", "16:53", "16:54", "16:55", "16:56", "16:57", "16:58",
"16:59", "17:00", "17:01", "17:02", "17:03", "17:04", "17:05",
"17:06", "17:07", "17:08", "17:09", "17:10", "17:11", "17:12",
"17:14", "17:15", "17:17", "17:18", "17:19", "17:20", "17:21",
"17:22", "17:23", "17:24", "17:25", "17:26", "17:28", "17:29",
"17:30", "17:31", "17:32", "17:34", "17:35", "17:36", "17:38",
"17:39", "17:40", "17:41", "17:43", "17:44", "17:45", "17:50",
"17:51", "17:52", "17:54", "17:58", "18:00", "18:03", "18:09",
"18:11", "18:15", "18:27", "2:40", "21:24", "21:27", "21:39",
"3:48", "7:51", "8:00", "8:04", "8:05", "8:10", "8:14", "8:15",
"8:18", "8:26", "8:29", "8:31", "8:33", "8:37", "8:39", "8:40",
"8:41", "8:43", "8:44", "8:45", "8:47", "8:48", "8:50", "8:51",
"8:52", "8:54", "8:55", "8:57", "8:58", "8:59", "9:00", "9:01",
"9:02", "9:03", "9:04", "9:05", "9:06", "9:07", "9:08", "9:09",
"9:11", "9:12", "9:13", "9:14", "9:15", "9:17", "9:18", "9:19",
"9:20", "9:21", "9:22", "9:23", "9:24", "9:25", "9:27", "9:28",
"9:30", "9:32", "9:33", "9:34", "9:35", "9:36", "9:37", "9:38",
"9:39", "9:40", "9:42", "9:43", "9:44", "9:45", "9:46", "9:47",
"9:48", "9:49", "9:50", "9:51", "9:52", "9:53", "9:54", "9:55",
"9:56", "9:57", "9:58", "9:59"), class = "factor"), Description = structure(c(5L,
6L, 6L, 6L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L), .Label = c("BGM",
"Dextrose 50% (mL)", "dextrose Tabs", "Disconnect or Reconnect Time",
"Food or Drink", "Humalog (units)", "Humalog sc (units)",
"Humalog SC (units)", "Injection (ccs)", "IV Dextrose(mL)",
"Lantus (units)", "Levemir (units)", "Novolin R (units)",
"Novolin R IV (units)", "Oral", "Other", "YSI"), class = "factor"),
Amount = c(127, 8, 8, 4, 161.5, 150.5, 150, 144.5, 138, 122,
119, 114.5, 110, 57.95, 53.95, 102, 156, 217, 250, 273, 275,
277, 350, 350, 350), Type = structure(c(2L, 4L, 4L, 4L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 3L, 3L, 3L), .Label = c("BG Data (mg/dL)", "Carb (grams)",
"Disconnect or Reconnect Time", "Insulin (units)"), class = "factor"),
Order = c(1L, 125L, 126L, 127L, 461L, 462L, 463L, 464L, 465L,
466L, 467L, 468L, 469L, 470L, 471L, 472L, 473L, 474L, 475L,
476L, 477L, 478L, 1881L, 1882L, 1883L), time = structure(c(1422366000,
1422359640, 1422375000, 1422378600, 1422349320, 1422350700,
1422351600, 1422352500, 1422353400, 1422356400, 1422357300,
1422359340, 1422360240, 1422363900, 1422365100, 1422369600,
1422371400, 1422373200, 1422375000, 1422376800, 1422378600,
1422380400, 1422357000, 1422364980, 1422370680), class = c("POSIXct",
"POSIXt"), tzone = "GMT")), .Names = c("EDC.ID.", "Subject.ID..",
"Visit", "Date", "Start", "End", "Description", "Amount", "Type",
"Order", "time"), row.names = c(1L, 125L, 126L, 127L, 461L, 462L,
463L, 464L, 465L, 466L, 467L, 468L, 469L, 470L, 471L, 472L, 473L,
474L, 475L, 476L, 477L, 478L, 1881L, 1882L, 1883L), class = "data.frame")
pdf("Glucose and Insulin Data.pdf", paper='USr', height= XXX, width= XXX)
其中 XXX 是以英寸为单位指定的单位
我想增加下图的大小,使其占据更多页面并更易于阅读。高度没问题,我只想拉伸x轴。
这是我的代码:
pdf("Glucose and Insulin Data.pdf", paper='USr')
library(ggplot2)
library(dplyr)
library(scales)
library(gridExtra)
#get data from Visit 1
carb1<-subset(data1,Visit == 1)
visit1 <- toString(carb1[1,3])
id1 <- toString(carb1[1,1])
date1<- toString(carb1[1,4])
carb1$Amount = as.numeric(as.character(carb1$Amount))
carb1$time = as.POSIXct(carb1$Start, format = "%H:%M", tz = "GMT")
q <- ggplot(data=carb1, aes(x=time, y=Amount, group=Description, color= Description, shape=Type, label=Amount )) + geom_text(data=carb1[carb1$Type=="Insulin (units)", ], size=3, hjust=0, vjust=2, color="black") + geom_bar(data=carb1[carb1$Type=="Carb (grams)", ], stat="identity", width=.1) + geom_point(data=carb1[carb1$Description != "Disconnect or Reconnect Time", ], size=4) + theme(text = element_text(size=10),
axis.text.x = element_text(angle=90, vjust=1)) + scale_y_continuous(breaks = round(seq(0, max(carb1$Amount), by = 50),2)) + xlab("Time (HH:MM)") + ylab("Glucose (mg/dL), Carbohydrates (grams)") + ggtitle(toString(c("Blood Glucose Measurements \n with Carbohydrate and Insulin Administration"))) + geom_bar(data=carb1[carb1$Type=="Disconnect or Reconnect Time", ], width=.1, stat="identity") + scale_x_datetime(breaks=date_breaks("1 hour"), labels= date_format("%H:%M")) + theme_bw() + scale_shape_manual(values=c(16,17,15,18)) + theme(plot.margin = unit(c(0,0,0,0), "cm"))
q
grid.text((paste("Patient ID:", id1, sep = " ")),
x = unit(.922, "npc"), y = unit(.89, "npc"), just = c("right", "top"),
gp = gpar(fontface = "bold", fontsize = 12, col = "black"))
grid.text((paste("Visit:", visit1, sep = " ")),
x = unit(.828, "npc"), y = unit(.85, "npc"), just = c("right", "top"),
gp = gpar(fontface = "bold", fontsize = 12, col = "black"))
grid.text((paste("Date:", date1, sep = " ")),
x = unit(.87 , "npc"), y = unit(.81, "npc"), just = c("right", "top"),
gp = gpar(fontface = "bold", fontsize = 12, col = "black"))
dev.off()
以及 carb1
的数据:
> dput(carb1)
structure(list(EDC.ID. = structure(c(14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L), .Label = c("Subject 1", "Subject 10",
"Subject 11", "Subject 12", "Subject 13", "Subject 14", "Subject 15",
"Subject 16", "Subject 17", "Subject 18", "Subject 19", "Subject 2",
"Subject 20", "Subject 3", "Subject 4", "Subject 5", "Subject 6",
"Subject 7", "Subject 8", "Subject 9"), class = "factor"), Subject.ID.. = c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), Visit = c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L), Date = structure(c(12L, 12L, 12L, 12L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L), .Label = c("-", "10/1/14", "10/3/14", "10/7/14",
"8/14/14", "8/18/14", "8/19/14", "8/20/14", "8/21/14", "8/25/14",
"8/27/14", "8/28/14", "9/1/14", "9/10/14", "9/12/14", "9/15/14",
"9/16/14", "9/18/14", "9/19/14", "9/2/14", "9/22/14", "9/23/14",
"9/24/14", "9/25/14", "9/26/14", "9/29/14", "9/3/14", "9/30/14",
"9/4/14", "9/5/14", "9/8/14", "9/9/14"), class = "factor"), Start = structure(c(218L,
116L, 361L, 420L, 487L, 508L, 521L, 535L, 13L, 63L, 78L, 111L,
125L, 184L, 204L, 274L, 302L, 331L, 361L, 391L, 420L, 443L, 73L,
202L, 290L), .Label = c("0:16", "1:25", "10:00", "10:01", "10:02",
"10:03", "10:04", "10:05", "10:06", "10:07", "10:08", "10:09",
"10:10", "10:11", "10:12", "10:13", "10:14", "10:15", "10:16",
"10:17", "10:18", "10:19", "10:20", "10:21", "10:22", "10:23",
"10:24", "10:25", "10:26", "10:27", "10:28", "10:29", "10:30",
"10:31", "10:32", "10:33", "10:34", "10:35", "10:36", "10:37",
"10:38", "10:39", "10:40", "10:41", "10:42", "10:43", "10:44",
"10:45", "10:46", "10:47", "10:48", "10:49", "10:50", "10:51",
"10:52", "10:53", "10:54", "10:55", "10:56", "10:57", "10:58",
"10:59", "11:00", "11:01", "11:02", "11:03", "11:04", "11:05",
"11:06", "11:07", "11:08", "11:09", "11:10", "11:11", "11:12",
"11:13", "11:14", "11:15", "11:16", "11:17", "11:18", "11:19",
"11:20", "11:21", "11:22", "11:23", "11:24", "11:25", "11:26",
"11:27", "11:28", "11:29", "11:30", "11:31", "11:33", "11:34",
"11:35", "11:36", "11:37", "11:38", "11:39", "11:40", "11:41",
"11:42", "11:43", "11:44", "11:45", "11:46", "11:47", "11:48",
"11:49", "11:50", "11:51", "11:52", "11:53", "11:54", "11:55",
"11:56", "11:57", "11:58", "11:59", "12:00", "12:01", "12:03",
"12:04", "12:05", "12:06", "12:07", "12:08", "12:09", "12:10",
"12:11", "12:12", "12:13", "12:14", "12:15", "12:16", "12:18",
"12:19", "12:20", "12:21", "12:22", "12:23", "12:24", "12:25",
"12:26", "12:27", "12:28", "12:29", "12:30", "12:31", "12:32",
"12:33", "12:34", "12:35", "12:36", "12:37", "12:38", "12:39",
"12:40", "12:41", "12:42", "12:43", "12:44", "12:45", "12:46",
"12:47", "12:48", "12:49", "12:50", "12:51", "12:52", "12:53",
"12:54", "12:55", "12:56", "12:57", "12:58", "12:59", "13:00",
"13:01", "13:03", "13:04", "13:05", "13:06", "13:07", "13:08",
"13:09", "13:10", "13:11", "13:12", "13:13", "13:14", "13:15",
"13:16", "13:17", "13:18", "13:19", "13:20", "13:21", "13:22",
"13:23", "13:24", "13:25", "13:27", "13:28", "13:29", "13:30",
"13:31", "13:32", "13:33", "13:34", "13:35", "13:36", "13:37",
"13:38", "13:39", "13:40", "13:41", "13:42", "13:44", "13:45",
"13:46", "13:47", "13:48", "13:49", "13:50", "13:51", "13:52",
"13:53", "13:54", "13:55", "13:56", "13:57", "13:58", "13:59",
"14:00", "14:01", "14:02", "14:03", "14:04", "14:05", "14:06",
"14:08", "14:09", "14:10", "14:11", "14:12", "14:14", "14:15",
"14:16", "14:17", "14:18", "14:19", "14:20", "14:21", "14:22",
"14:23", "14:24", "14:25", "14:26", "14:27", "14:28", "14:29",
"14:30", "14:31", "14:33", "14:34", "14:35", "14:36", "14:37",
"14:38", "14:39", "14:40", "14:41", "14:42", "14:43", "14:44",
"14:45", "14:46", "14:48", "14:49", "14:50", "14:51", "14:52",
"14:53", "14:54", "14:55", "14:57", "14:58", "14:59", "15:00",
"15:01", "15:02", "15:03", "15:04", "15:05", "15:06", "15:07",
"15:08", "15:09", "15:10", "15:12", "15:13", "15:14", "15:15",
"15:16", "15:17", "15:18", "15:19", "15:20", "15:21", "15:22",
"15:23", "15:24", "15:25", "15:26", "15:27", "15:28", "15:29",
"15:30", "15:31", "15:32", "15:33", "15:34", "15:35", "15:36",
"15:37", "15:38", "15:39", "15:40", "15:41", "15:42", "15:43",
"15:44", "15:45", "15:46", "15:47", "15:48", "15:49", "15:50",
"15:51", "15:52", "15:53", "15:54", "15:55", "15:56", "15:57",
"15:58", "15:59", "16:00", "16:01", "16:02", "16:03", "16:04",
"16:05", "16:06", "16:07", "16:08", "16:09", "16:10", "16:11",
"16:12", "16:13", "16:14", "16:15", "16:16", "16:17", "16:18",
"16:19", "16:20", "16:21", "16:22", "16:23", "16:24", "16:25",
"16:26", "16:27", "16:28", "16:29", "16:30", "16:31", "16:32",
"16:33", "16:34", "16:35", "16:36", "16:37", "16:38", "16:39",
"16:40", "16:42", "16:43", "16:44", "16:45", "16:46", "16:47",
"16:48", "16:49", "16:50", "16:51", "16:52", "16:53", "16:54",
"16:55", "16:56", "16:57", "16:58", "16:59", "17:00", "17:01",
"17:02", "17:03", "17:04", "17:05", "17:06", "17:07", "17:08",
"17:09", "17:10", "17:11", "17:12", "17:14", "17:15", "17:17",
"17:18", "17:19", "17:20", "17:21", "17:22", "17:23", "17:24",
"17:25", "17:26", "17:29", "17:30", "17:32", "17:34", "17:35",
"17:36", "17:38", "17:39", "17:40", "17:45", "17:50", "17:51",
"17:54", "18:09", "18:15", "2:40", "21:24", "21:27", "21:39",
"3:48", "7:51", "8:00", "8:04", "8:05", "8:10", "8:14", "8:15",
"8:18", "8:26", "8:29", "8:31", "8:33", "8:37", "8:39", "8:40",
"8:41", "8:43", "8:44", "8:45", "8:47", "8:48", "8:50", "8:51",
"8:52", "8:54", "8:55", "8:56", "8:57", "8:58", "8:59", "9:00",
"9:01", "9:02", "9:03", "9:04", "9:05", "9:06", "9:07", "9:08",
"9:09", "9:11", "9:12", "9:13", "9:14", "9:15", "9:17", "9:18",
"9:19", "9:20", "9:21", "9:22", "9:23", "9:24", "9:25", "9:27",
"9:28", "9:29", "9:30", "9:32", "9:33", "9:34", "9:35", "9:36",
"9:37", "9:38", "9:39", "9:40", "9:42", "9:43", "9:44", "9:45",
"9:46", "9:47", "9:48", "9:49", "9:50", "9:51", "9:52", "9:53",
"9:54", "9:55", "9:56", "9:57", "9:58", "9:59"), class = "factor"),
End = structure(c(240L, 114L, 360L, 419L, 496L, 517L, 529L,
543L, 13L, 62L, 76L, 109L, 123L, 182L, 202L, 273L, 301L,
330L, 360L, 390L, 419L, 444L, 190L, 260L, 457L), .Label = c("0:16",
"1:25", "10:00", "10:01", "10:02", "10:03", "10:04", "10:05",
"10:06", "10:07", "10:08", "10:09", "10:10", "10:11", "10:12",
"10:13", "10:14", "10:15", "10:16", "10:17", "10:18", "10:19",
"10:20", "10:21", "10:22", "10:23", "10:24", "10:25", "10:26",
"10:27", "10:28", "10:29", "10:30", "10:31", "10:32", "10:33",
"10:34", "10:35", "10:36", "10:37", "10:38", "10:39", "10:40",
"10:41", "10:42", "10:43", "10:44", "10:45", "10:46", "10:47",
"10:48", "10:49", "10:50", "10:51", "10:52", "10:53", "10:54",
"10:55", "10:57", "10:58", "10:59", "11:00", "11:01", "11:03",
"11:04", "11:05", "11:06", "11:07", "11:08", "11:09", "11:10",
"11:11", "11:12", "11:13", "11:14", "11:15", "11:16", "11:17",
"11:18", "11:19", "11:20", "11:21", "11:22", "11:23", "11:24",
"11:25", "11:26", "11:27", "11:28", "11:29", "11:30", "11:31",
"11:33", "11:34", "11:35", "11:36", "11:37", "11:38", "11:39",
"11:40", "11:41", "11:42", "11:43", "11:44", "11:45", "11:46",
"11:47", "11:48", "11:49", "11:50", "11:51", "11:52", "11:53",
"11:54", "11:55", "11:56", "11:57", "11:58", "11:59", "12:00",
"12:01", "12:03", "12:04", "12:05", "12:06", "12:07", "12:08",
"12:09", "12:10", "12:11", "12:12", "12:13", "12:14", "12:15",
"12:16", "12:18", "12:19", "12:20", "12:21", "12:22", "12:23",
"12:24", "12:25", "12:26", "12:27", "12:28", "12:29", "12:30",
"12:31", "12:32", "12:33", "12:34", "12:35", "12:36", "12:37",
"12:38", "12:39", "12:40", "12:41", "12:42", "12:43", "12:44",
"12:45", "12:46", "12:47", "12:48", "12:49", "12:50", "12:51",
"12:52", "12:53", "12:54", "12:55", "12:56", "12:57", "12:58",
"12:59", "13:00", "13:01", "13:03", "13:04", "13:05", "13:06",
"13:07", "13:08", "13:09", "13:10", "13:11", "13:12", "13:13",
"13:14", "13:15", "13:16", "13:17", "13:18", "13:19", "13:20",
"13:21", "13:22", "13:23", "13:24", "13:25", "13:27", "13:28",
"13:29", "13:30", "13:31", "13:32", "13:33", "13:34", "13:35",
"13:36", "13:37", "13:38", "13:39", "13:40", "13:41", "13:42",
"13:43", "13:44", "13:45", "13:46", "13:48", "13:49", "13:50",
"13:51", "13:52", "13:53", "13:54", "13:55", "13:56", "13:57",
"13:58", "13:59", "14:00", "14:01", "14:02", "14:03", "14:04",
"14:05", "14:06", "14:08", "14:09", "14:10", "14:11", "14:12",
"14:13", "14:14", "14:15", "14:16", "14:17", "14:18", "14:19",
"14:20", "14:21", "14:22", "14:23", "14:24", "14:25", "14:26",
"14:27", "14:28", "14:29", "14:30", "14:31", "14:33", "14:34",
"14:35", "14:36", "14:37", "14:38", "14:39", "14:40", "14:41",
"14:42", "14:43", "14:44", "14:45", "14:46", "14:48", "14:49",
"14:50", "14:51", "14:52", "14:53", "14:54", "14:55", "14:57",
"14:58", "14:59", "15:00", "15:01", "15:02", "15:03", "15:04",
"15:05", "15:06", "15:07", "15:08", "15:09", "15:10", "15:12",
"15:13", "15:14", "15:15", "15:16", "15:17", "15:18", "15:19",
"15:20", "15:21", "15:22", "15:23", "15:24", "15:25", "15:26",
"15:27", "15:28", "15:29", "15:30", "15:31", "15:32", "15:33",
"15:34", "15:35", "15:36", "15:37", "15:38", "15:39", "15:40",
"15:41", "15:42", "15:43", "15:44", "15:45", "15:46", "15:47",
"15:48", "15:49", "15:50", "15:51", "15:52", "15:53", "15:54",
"15:55", "15:56", "15:57", "15:58", "15:59", "16:00", "16:01",
"16:02", "16:03", "16:04", "16:05", "16:06", "16:07", "16:08",
"16:09", "16:10", "16:11", "16:12", "16:13", "16:14", "16:15",
"16:16", "16:17", "16:18", "16:19", "16:20", "16:21", "16:22",
"16:23", "16:24", "16:25", "16:26", "16:27", "16:28", "16:29",
"16:30", "16:31", "16:32", "16:33", "16:34", "16:35", "16:36",
"16:37", "16:38", "16:39", "16:40", "16:42", "16:43", "16:44",
"16:45", "16:46", "16:47", "16:48", "16:49", "16:50", "16:51",
"16:52", "16:53", "16:54", "16:55", "16:56", "16:57", "16:58",
"16:59", "17:00", "17:01", "17:02", "17:03", "17:04", "17:05",
"17:06", "17:07", "17:08", "17:09", "17:10", "17:11", "17:12",
"17:14", "17:15", "17:17", "17:18", "17:19", "17:20", "17:21",
"17:22", "17:23", "17:24", "17:25", "17:26", "17:28", "17:29",
"17:30", "17:31", "17:32", "17:34", "17:35", "17:36", "17:38",
"17:39", "17:40", "17:41", "17:43", "17:44", "17:45", "17:50",
"17:51", "17:52", "17:54", "17:58", "18:00", "18:03", "18:09",
"18:11", "18:15", "18:27", "2:40", "21:24", "21:27", "21:39",
"3:48", "7:51", "8:00", "8:04", "8:05", "8:10", "8:14", "8:15",
"8:18", "8:26", "8:29", "8:31", "8:33", "8:37", "8:39", "8:40",
"8:41", "8:43", "8:44", "8:45", "8:47", "8:48", "8:50", "8:51",
"8:52", "8:54", "8:55", "8:57", "8:58", "8:59", "9:00", "9:01",
"9:02", "9:03", "9:04", "9:05", "9:06", "9:07", "9:08", "9:09",
"9:11", "9:12", "9:13", "9:14", "9:15", "9:17", "9:18", "9:19",
"9:20", "9:21", "9:22", "9:23", "9:24", "9:25", "9:27", "9:28",
"9:30", "9:32", "9:33", "9:34", "9:35", "9:36", "9:37", "9:38",
"9:39", "9:40", "9:42", "9:43", "9:44", "9:45", "9:46", "9:47",
"9:48", "9:49", "9:50", "9:51", "9:52", "9:53", "9:54", "9:55",
"9:56", "9:57", "9:58", "9:59"), class = "factor"), Description = structure(c(5L,
6L, 6L, 6L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L, 4L), .Label = c("BGM",
"Dextrose 50% (mL)", "dextrose Tabs", "Disconnect or Reconnect Time",
"Food or Drink", "Humalog (units)", "Humalog sc (units)",
"Humalog SC (units)", "Injection (ccs)", "IV Dextrose(mL)",
"Lantus (units)", "Levemir (units)", "Novolin R (units)",
"Novolin R IV (units)", "Oral", "Other", "YSI"), class = "factor"),
Amount = c(127, 8, 8, 4, 161.5, 150.5, 150, 144.5, 138, 122,
119, 114.5, 110, 57.95, 53.95, 102, 156, 217, 250, 273, 275,
277, 350, 350, 350), Type = structure(c(2L, 4L, 4L, 4L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 3L, 3L, 3L), .Label = c("BG Data (mg/dL)", "Carb (grams)",
"Disconnect or Reconnect Time", "Insulin (units)"), class = "factor"),
Order = c(1L, 125L, 126L, 127L, 461L, 462L, 463L, 464L, 465L,
466L, 467L, 468L, 469L, 470L, 471L, 472L, 473L, 474L, 475L,
476L, 477L, 478L, 1881L, 1882L, 1883L), time = structure(c(1422366000,
1422359640, 1422375000, 1422378600, 1422349320, 1422350700,
1422351600, 1422352500, 1422353400, 1422356400, 1422357300,
1422359340, 1422360240, 1422363900, 1422365100, 1422369600,
1422371400, 1422373200, 1422375000, 1422376800, 1422378600,
1422380400, 1422357000, 1422364980, 1422370680), class = c("POSIXct",
"POSIXt"), tzone = "GMT")), .Names = c("EDC.ID.", "Subject.ID..",
"Visit", "Date", "Start", "End", "Description", "Amount", "Type",
"Order", "time"), row.names = c(1L, 125L, 126L, 127L, 461L, 462L,
463L, 464L, 465L, 466L, 467L, 468L, 469L, 470L, 471L, 472L, 473L,
474L, 475L, 476L, 477L, 478L, 1881L, 1882L, 1883L), class = "data.frame")
pdf("Glucose and Insulin Data.pdf", paper='USr', height= XXX, width= XXX)
其中 XXX 是以英寸为单位指定的单位