You are here:
Vanderbilt Biostatistics Wiki
>
Main Web
>
Seminars
>
RClinic
>
BrokenAxisExample
(revision 1)
Edit
Attach
library(Hmisc) library(Design)
par(mar=c(5, 0,0,0), cex.axis=1.5) plot(seq(0,4, 0.5), seq(0,0.75, length=length(seq(0,4, 0.5))), axes=FALSE, type="n", xlab="", ylab="")
# Add group labels text(0, 0.1, "All trials", adj=c(0, 0.5), cex=1.5, font=2) text(3.5, 0.1, "0.55 (0.36, 0.86)", adj=c(0.5, 0.5), cex=1.5, font=2) text(0, 0.2, "Stop - HTN", adj=c(0, 0.5), cex=1.5) text(3.5, 0.2, "0.34 (0.11, 1.03)", adj=c(0.5, 0.5), cex=1.5) text(0, 0.3,"MRC - Older Adults", adj=c(0, 0.5), cex=1.5) text(3.5, 0.3,"0.64 (0.38, 1.11)", adj=c(0.5, 0.5), cex=1.5) text(0, 0.4,"EWPHE", adj=c(0, 0.5), cex=1.5) text(3.5, 0.4,"0.87 (0.30, 2.58)", adj=c(0.5, 0.5), cex=1.5)
# Add blue polygon # -------------------------------------------------- library(gplots) polygon(x=c(seq(1.0, 3.0, 0.50), seq(3.0, 1.0, -0.50)), y=c(rep(0, 5), rep(0.50, 5)), col=bluered(100)[35], border=bluered(100)[35])
#
***********************************
# Add break lines along x-axis text("l", x=2.20, y=0, srt=-45, font=2) text("l", x=2.25, y=0, srt=-45, font=2) lines(x=c(1.0, 2.20), y=c(0,0), lwd=2) lines(x=c(2.25, 3.0), y=c(0,0), lwd=2) #
***********************************
# Add x-axis # ------------------------------------------------------- axis(side=1, at=seq(1, 3, 0.5), line=-1, tick=FALSE, labels=c("0.0", "0.5", "1.0", "2.5", "3.0")) mtext("l", side=1, line=-1.5, at=seq(1, 3, 0.5), font=2)
# Add vertical line at "1.0" # --------------------------------------- lines(x=c(2.0, 2.0), y=c(0, 0.5), lwd=2)
# Add extra headers text(3.5, 0.525,"RR (CI)", adj=0.5, cex=1.5, font=2) text(2.0, 0.575,"Relative Risk (CI)", adj=0.5, cex=1.5, font=2) lines(x=c(1.5, 2.5), y=c(0.55, 0.55)) text(2.0, 0.525,"active : control", adj=0.5, cex=1.5, font=2) text(2.0, 0.70, "SUDDEN CORONARY DEATH", cex=3, font=2)
# Add text to bottom margin axis(side=1, at=1.5, adj=0.5, labels="Active tx better", tick=FALSE, line=1, cex.axis=1.5) axis(side=1, at=2.5, adj=0.5, labels="Active tx worse", tick=FALSE, line=1, cex.axis=1.5)
# Add vertical line at "All RR" # ------------------------------------- lines(x=c((1 + 0.55), (1 + 0.55)), y=c(0, 0.50), lty=3, lwd=3)
# Add RR and CI lines # --------------------------------------------- rr<-c(0.55, 0.34, 0.64, 0.87) # All -> Stop -> MRC -> EWPHE rru<-c(0.86, 1.03, 1.11, 2.58) rrl<-c(0.36, 0.11, 0.38, 0.30) rreqn<-1 + rr rrueqn<-1 + rru rrleqn<-1 + rrl # All trials lines(x=c(rrleqn[1], rrueqn[1]), y=c(0.1, 0.1), lwd=2) polygon(x=c(rreqn[1]-(5761/840)*(0.01), rreqn[1], rreqn[1]+(5761/840)*(0.01), rreqn[1]), y=c(0.1,
1-(5761/840)*(0.01/4),
1,
1+(5761/840)*(0.01/4)), col="white", border=1) # Stop - HTN
polygon(x=c(rreqn[2]-(1627/840)*(0.01), rreqn[2]+(1627/840)*(0.01), rreqn[2]+(1627/840)*(0.01), rreqn[2]-(1627/840)*(0.01)), y=c(0.2-(1627/840)*(0.01/4),
2-(1627/840)*(0.01/4),
2+(1627/840)*(0.01/4),
2+(1627/840)*(0.01/4)), col=1)
lines(x=c(rrleqn[2], rrueqn[2]), y=c(0.2, 0.2), lwd=2) # MRC - Older Adults polygon(x=c(rreqn[3]-(3294/840)*(0.01), rreqn[3]+(3294/840)*(0.01), rreqn[3]+(3294/840)*(0.01), rreqn[3]-(3294/840)*(0.01)), y=c(0.3-(3294/840)*(0.01/4),
3-(3294/840)*(0.01/4),
3+(3294/840)*(0.01/4),
3+(3294/840)*(0.01/4)), col=1)
lines(x=c(rrleqn[3], rrueqn[3]), y=c(0.3, 0.3), lwd=2) # EWPHE polygon(x=c(rreqn[4]-(0.01), rreqn[4]+(0.01), rreqn[4]+(0.01), rreqn[4]-(0.01)), y=c(0.4-(0.01/4), 0.4-(0.01/4),
4+(0.01/4), 0.4+(0.01/4)), col=1)
lines(x=c(rrleqn[4], 2.20), y=c(0.4, 0.4), lwd=2) lines(x=c(2.25, rru[4]), y=c(0.4, 0.4), lwd=2) # Add break lines.... text("l", x=2.20, y=0.4, srt=-45, font=2) text("l", x=2.25, y=0.4, srt=-45, font=2)
Edit
|
Attach
|
P
rint version
|
H
istory
:
r2
<
r1
|
B
acklinks
|
V
iew wiki text
|
Edit WikiText
|
More topic actions...
Topic revision: r1 - 08 Nov 2006,
TheresaScott
Main
Department Home Page
Biostatistics Graduate Program
Vanderbilt University Medical Center
Main Web
Main Web Home
Search
Recent Changes
Changes
Topic list
Biostatistics Webs
Archive
Main
Sandbox
System
Register
|
Log In
Copyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki?
Send feedback