[R] axis help

rich at thevillas.eclipse.co.uk rich at thevillas.eclipse.co.uk
Wed Feb 6 15:14:28 CET 2008



    Hi, i'm having trouble with my x and y axis. The commands i'm using are
   below. The problem is that the y axis starts at coordinate 0,1 and the x
   axis starts at coordinate 0,0. As far as I know the y axis can't  start at 0
   (because it's log scaled) ,so I would like to position the x axis at 0,1 but
   don't know how to do this. Could anyone advise?

   Thanks

   Rich

   df3<-data.frame(x=c(10,11,115,12,13,14,16,17,18,21,22,23,24,26,27,28,29,3,30
   ,32,33,34,35,4,41,45,5,50,52,56,58,6,67,6738,68,7,8,9,),fq=c(8,11,1,2,4,4,2,
   2,6,3,4,2,2,1,1,1,4,51,3,1,1,1,1,35,1,1,19,2,1,1,1,14,1,1,1,10,13,5,),fqcvd=
   c(5,8,1,1,3,3,2,2,5,3,4,2,2,0,1,1,3,13,2,1,1,1,1,17,1,0,11,2,1,1,1,7,1,1,1,7
   ,7,1,),fqcan=c(1,1,0,2,1,1,1,0,3,0,2,0,1,0,1,0,1,4,2,1,1,0,0,4,1,1,2,2,0,1,0
   ,2,0,1,1,2,3,1,),fqnondis=c(8,11,1,2,4,4,2,2,6,3,4,2,2,1,1,1,4,50,3,1,1,1,1,
   34,1,1,19,2,1,1,1,14,1,1,1,10,12,5,))
   k3<-with(df3,rep(x,times=fq))
   kcvd3<-with(df3,rep(x,times=fqcvd))
   kcvd3<-c(kcvd3,rep(NA,times=length(k3)-length(kcvd3)))
   kcan3<-with(df3,rep(x,times=fqcan))
   kcan3<-c(kcan3,rep(NA,times=length(k3)-length(kcan3)))
   knondis3<-with(df3,rep(x,times=fqnondis))
   knondis3<-c(knondis3,rep(NA,times=length(k3)-length(knondis3)))

   boxplot(kcvd3,kcan3,knondis3,log='y',
   ylim=c(1,4000),at=c(0.5,0.6,0.7),boxwex    =   0.05,axes=FALSE,col   =
   c("yellow","orange","red"))
   axis(1,at=c(0,0.6,1.1,1.6,2.1,2.6,3.1,3.6),labels=c(0,3,4,5,6,7,8,NA))
   axis(2)


More information about the R-help mailing list