Skip to content
Back to formatted view

Raw Message

Message-ID: <50826B9E.3070004@bitwrit.com.au>
Date: 2012-10-20T09:15:10Z
From: Jim Lemon
Subject: Centering labels on X-axis
In-Reply-To: <1350657593064-4646761.post@n4.nabble.com>

On 10/20/2012 01:39 AM, YAddo wrote:
> Dear all:
> I am trying to center labels on my plot with not much success. I have tried
> text(), mtext() but it's not working. I think I am using the wrong function
> for  my task.
>
>   Any help will be appreciated.
>
> My working codes.
> axis(1,
> at=c(1,2,3,4,5),font.lab=2,cex.axis=1.5,cex.lab=3,label=c("W0","CWH2","CWHmc","CH2","CHmc")
> ,text=c(1.5,2.5,3.5,4.5,5.5))
>
Hi YAddo,
Perhaps the most common problem with getting the positions of axis 
labels right occurs with barplots. The bars in the standard "barplot" 
function are not centered on integer values, but the centers are 
returned from the function:

barpos<-barplot(...)
axis(1,at=barpos,...)

Is this the problem you are having?

Jim