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 [[alternative HTML version deleted]]
Vera, Pedro L. <pvera <at> health.usf.edu> writes:> > 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 withsome sort of tick mark that is off> the midpoint of the bars). Any suggestions would be greatly appreciated. >I can't find bargraphCI using the R site search, so I can't tell you anything about how to work with it. What package does it come from?? (As the posting guide says, please send a simple reproducible example -- including any library() statements you used to load packages, and/or the output of sessionInfo() .) If bargraphCI works anything like barplot in base R, then b=bargraphCI(...) will assign the midpoints of the bars to b so you can use them in subsequent graphics calls. Ben Bolker
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 SurgeryAssuming 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