[R] boxplot axis labelling
Jim Lemon
jim at bitwrit.com.au
Fri Jan 25 11:21:20 CET 2008
rich at thevillas.eclipse.co.uk wrote:
>
> Hi,
>
>
> i'm very new to R, so sorry for what i'm sure is a very basic question. I'm
> producing a boxplot with the data below:
>
> 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,4
> 1,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),
> fqnoncan=c(8,11,0,2,4,4,2,0,6,0,4,0,2,0,1,0,4,50,3,1,1,0,0,35,1,1,19,2,0,1,0
> ,14,0,1,1,10,13,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)))
> knoncan3<-with(df3,rep(x,times=fqnoncan))
> knoncan3<-c(knoncan3,rep(NA,times=length(k3)-length(knoncan3)))
> dfnew<-data.frame(kcvd3,kcan3,knoncan3,k3)
> boxplot(dfnew,log='y', ylim=c(1,4000))
>
>
> This produces x axis labels 'kcvd3,kcan3,knoncan3,k3', one for each plot as
> you might expect. However, I would like all plot to sit next to each other
> with a single label. Could anybody help?
>
Hi Rich,
boxplot(dfnew,log='y',ylim=c(1,4000),names=rep("",4),
xlab="This is my label")
Jim
More information about the R-help
mailing list