[R] Problem adjusting x-labels with bargraphCI

Manuel Morales Manuel.A.Morales at williams.edu
Wed Mar 21 01:12:37 CET 2007


On Tue, 2007-03-20 at 13:15 -0400, Vera, Pedro L. wrote:
> Hello:
>  
> I'm having quite a bit of difficulty adjusting the x-labels using bargraphCI. I've tried using text and srt=45 to rotate the labels or mtext for 2 lines to break up the labels. However, using either method, I cannot line up the labels with the midpoints of the bars (they line up with some sort of tick mark that is off the midpoint of the bars). Any suggestions would be greatly appreciated.
>  
> Regards
>  
> Pedro L. Vera, Ph.D.
> University of South Florida, Dept of Surgery

Assuming that you are asking about bargraph.CI from the sciplot package,
and that you are trying to get x-axis tick-labels that are perpendicular
to the x-axis, specifying las=2 in the call to bargraph.CI should work.

If you want more control, you can assign the output of bargraph.CI to an
object (a list that contains the x-values of the bars, summary stats,
and CIs). This will allow you to position labels at the x-values of the
plotted bars. For example:

test <- bargraph.CI(x.factor = dose, response = len, data = ToothGrowth, xaxt="n")
axis(side=1,at=test$xvals,labels=c("bar1","bar2","bar3"),las=2)

-- 
Manuel A. Morales
http://mutualism.williams.edu


More information about the R-help mailing list