[R] barplots and missing xlabels

Geoff Russell geoffrey.russell at gmail.com
Mon Jan 14 22:09:19 CET 2008


On 1/15/08, -Halcyon- <Cyonora at gmail.com> wrote:
>
> Hi,
>
> I'd say just stretch the plot window. The code works fine and labels are all
> present

The labels didn't appear on my pdf output but the following code worked fine

xpos<-barplot(dat$Aorta,ylim=c(0,100),
 names=rep("",length(dat$AgeGroup)),
 ylab=c("Prevalence (%)"))
mtext(as.vector(dat$AgeGroup),1,2,at=xpos)

Many thanks,

Geoff.


>
> Gz
>
>
> Jim Lemon-2 wrote:
> >
> > Geoff Russell wrote:
> >> Dear useRs,
> >>
> >> The following plots only print 2 of the 4 labels under the bars, is there
> >> a way please to force all 4 labels to print?
> >>
> >> par(mfrow=c(1,2),mar=c(2,7,3,1))
> >> dat<-data.frame("AgeGroup"=c("2-15","16-20","21-25","26-39"),
> >> "Aorta"=c(20,8,30,60),
> >> "Coronary"=c(7,30,55,65))
> >> barplot(dat$Aorta,ylim=c(0,100),names=as.vector(dat$AgeGroup),ylab=c("Prevalence
> >> (%)"))
> >> title(main=list("Aorta",font=0))
> >> barplot(dat$Coro,names=as.vector(dat$Age),ylim=c(0,100))
> >> title(main=list("Coronary Artery",font=0))
> >>
> > Hi Geoff,
> >
> > Try this:
> >
> > barplot(dat$Aorta,ylim=c(0,100),
> >   names=rep("",length(dat$AgeGroup)),
> >   ylab=c("Prevalence (%)"))
> > mtext(dat$AgeGroup,1,2)
> >
> > Jim
> >
> > ______________________________________________
> > 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.
> >
> >
>
> --
> View this message in context: http://www.nabble.com/barplots-and-missing-xlabels-tp14796430p14802702.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>


-- 
6 Fifth Ave,
St Morris, S.A. 5068
Australia
Ph: 041 8805 184 / 08 8332 5069




More information about the R-help mailing list