平喘药实验简单作图

library(gdata)
rawData <- read.xls("平喘药实验.xlsx",
                      encoding="GBK", header=F)[c(-1, -2, -3), c(-1)]

dataDF <- data.frame(value=as.numeric(t(rawData)), 
                     time=rep(1:ncol(rawData)-1, times=nrow(rawData)),
                     group=factor(
                       rep(c("H", "Iso", "BH", "ACh", "Iso2"),
                           each=ncol(rawData)), levels=
                       c("H", "Iso", "BH", "ACh", "Iso2")))

labeli <- function(variable, value){
  names_li <- list("H"="组胺", "Iso"="异丙肾上腺素", "BH"="苯海拉明+组胺", "ACh"="乙酰胆碱",
                   "Iso"="异丙肾上腺素")
  return(names_li[value])
}

library(ggplot2)

p <- ggplot(dataDF, aes(x=time, value))+
  geom_line(lwd=1.2)+theme_bw() +
  facet_wrap(~group, labeller=labeli)+
  theme(strip.text.x = element_text(size = 10, face="bold"))+
  theme(axis.text.x=element_text(face="bold", size=10), 
         axis.text.y=element_text(face="bold", size=10), 
         axis.title.y=element_text(size=10, face="bold"))+
  xlab("时间(min)")+ylab("灌注液流速(ml/min)")
  
pdf("result.pdf", width=5, height=4)
p
dev.off()
平喘药实验简单作图_第1张图片

你可能感兴趣的:(平喘药实验简单作图)