[R] Misalignment of secondary axis on boxplot

s.e.roberts at qmul.ac.uk s.e.roberts at qmul.ac.uk
Sun Mar 12 14:34:32 CET 2006


Dear R-help,

I am trying to overlay a secondary y-axis over a boxplot. The problem is that
the point of the line does not correspond to the centrepoint of the boxplot,
which makes presentation and interpretation sloppy. Could someone point out
where I am going wrong please?


#DATA

f<-factor(ld$Name[ld$Order==5],levels=c("SVR","MKF","DRCH","TNC","MTN","WLB","HMB"))

g<-c(0.0213750, 0.0017000, 0.0228150, 0.0000000, 0.0787800,NA, 0.0220400,
0.0471900, 0.0060500, NA, 0.0285600, 0.0079980,
0.0000000,NA,0.0175560,0.0754110,NA, 0.0702780,NA, 0.0065875, 0.0000000, NA,
0.0000000, 0.0000000, 0.0723450, 0.0143520, 0.0000000, 0.1398600, 0.0032000,
NA,NA,0.0500850,NA, 0.0038250, 0.0000000,0.0071250, 0.0394200, 0.0000000,
0.0000000,NA,0.0000000,NA, 0.0000000, 0.0246375, NA, NA, 0.0120750,
0.0076125,NA,NA,0.0153400, 0.0077000,NA)

boxplot(g~f,ylab="",xlab="",main="")
par(new=T)
s.f<-c(0.5085714, 1.5777778, 0.6071429, 0.5233333, 0.5916667,1.1742857,
0.7987500)
plot(s.f,main="",ylab="",xlab="",type="b",axes=F,pch=19)
axis(4)

Thanks in advance,
Sion

(R 2.1.1)

--
Siôn Roberts

Department of Geography,
Queen Mary, University of London,
London,
E1 4NS.

Tel: +44 20 7882 5400
http://www.geog.qmul.ac.uk/postgraduate/student/roberts.html




More information about the R-help mailing list