[R] Odp: boxplot axis labelling

Petr PIKAL petr.pikal at precheza.cz
Thu Jan 24 22:35:33 CET 2008


Hi

r-help-bounces at r-project.org napsal dne 24.01.2008 18:20:41:

> 
> 
>    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))

Supress axes by axes=F and use xlab for some label and then add box or y 
axis by box() and axis(2)

Regards
Petr

> 
> 
>    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?
> 
>    cheers
> 
>    Rich
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list