[R] barplot(2?) with CI from a zero reference line

Marc Schwartz MSchwartz at MedAnalytics.com
Fri Nov 26 16:42:04 CET 2004

On Fri, 2004-11-26 at 07:56 +0100, Jean-Louis Abitbol wrote:
> Dear R Users, (and dear Marc)
> First of all many thanks for the answers to my previous questions.
> I would like to barplot the mean percent change of a variate with it's
> CI. Bars should start from the zero reference line to height (in
> barplot2).
> Is there a way to tweak barplot2, for example,  to do that ? 
> I have tried to see what the function was but unlike other functions was
> not able to list it by > barplot2. Is it because it is called through
> UseMethods ? 
> Thanks for any help.
> Jean-Louis


I may be mis-understanding what you are trying to do here, but do you
want to have a horizontal zero reference line in the middle of the plot,
such that you can have positive change bars going up from the line and
negative change bars going down from the line?

If so, the default mechanism will work:

barplot2(c(-1, 2, -3, 5, 4, -4))
abline(h = 0)

If that is the correct basic plot, just adjust the values for the CI's


Marc Schwartz

More information about the R-help mailing list