Hi 

I'd appreciate some help with plotting odds ratios. I want to rotate the
labels on the x-axis by 45 degrees. 

The usual way of doing this, using text - e.g. text(1, par('usr')[3]-2.25..)
-  gives no result when the y-axis is a log scale. 

I guess this is because, as the par help says, for a logarithmic y-axis:
y-limits will be 10 ^ par("usr")[3:4]

 

Does anyone know a solution for this?

 

The example below works well if log='y' is omitted.

 

Thanks very much for your help

Tim

 

#Create plot with log-scale on the y-axis

par(mar = c(7, 4, 4, 2) + 0.1)

plot(1, type='n', bty='n', 

        xlab="",

        ylab='Odds Ratio',

        xlim= c(0.5,4.5), 

        ylim= c(0.75, 2), 

        cex=2, xaxt='n', yaxt='n', cex.lab=1.3,

        log='y')

 

# Line of unity

segments(0,1,10,1,  lwd=2, lty=2)

 

#Estimates and confidence intervals

points(c(1:4),c(1.1,1.32,1.14,1.36), pch=17, cex=1.5, col='blue')

segments (c(1:4),c(0.93,1.11,0.94,1.15),c(1:4),c(1.3,1.58,1.37,1.61), 

          col='blue', lwd=2)

 

axis(1,c(1:4), labels= F)

axis(2, at=seq(0.75,2, by=0.25), labels=seq(0.75,2, by=0.25), las=1)

labels <- paste("Label", 1:4, sep = " ")

text(1:4-0.25, par('usr')[3]-0.15, xpd=TRUE, labels=labels, adj=0.1, srt=45)

mtext("Exposure", side=1, line=4.5, cex=1.5)

 


	[[alternative HTML version deleted]]

