Skip to content
Prev 157526 / 398506 Next

Trend graph

Try this:

pre <- c(1,2,3,4,5)
post <- c(2,5,7,2,3)

plot( 1:2, range(pre,post), type='n', xlab='', ylab='CRP (mg/dl)', xaxt='n')
segments(1,pre,2,post)
axis(1, at=1:2, labels=c('Pre','Post'))

### or one way to label the lines

par(mar=c(5,4,4,4)+0.1)

plot( 1:2, range(pre,post), type='n', xlab='', ylab='CRP (mg/dl)', xaxt='n')
segments(1,pre,2,post)
axis(1, at=1:2, labels=c('Pre','Post'))

tmp.y <- TeachingDemos::spread.labs(post, strheight('1'),
 min=min(post), max=max(post))

mtext( 1:5, side=4, at=tmp.y, line=2, las=1 )


hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111