dose <- c(20,30,40,45,60)
dragA <- c(16,20,27,40,60)
dragB <- c(15,18,25,31,40)
plot(dose,dragA,type="b")
plot(dose,dragB,type="b")
opar <- par(no.readonly = TRUE)
par(lty=2, pch=17)
plot(dose,dragA, type = "b")
plot(dose, dragA, type="b", lty=2,pch=19)
plot(dose, dragA, type = "b", lty=6, lwd=2, pch=11,cex=3, col="blue")
plot(dose, dragA, type = "b", lty=6, lwd=2, pch=11,cex=3, col="blue",col.axis="red")
plot(dose, dragA, type = "b", lty=6, lwd=2, pch=11,cex=3, col="blue",col.axis="red",col.lab="green")
opar <- par(no.readonly = TRUE)
par(pin=c(2,3))
par(lwd=2,cex=1.5)
par(cex.axis=0.75, font.axis=3)
plot(dose, dragA,type="b",pch=19, lty=2, col="red")
plot(dose, dragB,type="b",pch=23, lty=6, col="blue", bg="green")
par(opar)
plot(dose, dragA, type="b", col="red", lty=2, pch=2, lwd=2, main = "药物A的反应曲线", sub="测试数据",xlab="剂量",ylab="病人的反应", xlim=c(0,60),ylim=c(0,70))
一些画图参数描述:
给做坐标轴增加刻度与水平、垂直线:minor.tick(), abline()
plot(1:4, 1:4, type="b")
minor.tick(nx=3, ny=2, tick.ratio = 0.5)
abline(h=2, col="red",lty=2)
abline(v=2, col="blue",lty=1)
dose <- c(20,30,40,45,60)
dragA <- c(16,20,27,40,60)
dragB <- c(15,18,25,31,40)
plot(dose, dragA,type="b",pch=15,lty=1,col="red",ylim=c(0,60),main="A与B的对比", xlab="剂量", ylab="药物反应")
lines(dose,dragB, type="b",pch=17,lty=2,col="blue")
legend("topleft", inset=0.05, title = "类型",legend=c("A","B"),lty=c(1,2),pch=c(15,17),col=c("red", "blue"))