[R] Constructing bar charts with standard error bars

John Zabroski johnzabroski at gmail.com
Thu Jul 26 17:13:19 CEST 2007

On 7/25/07, Ben Bolker <bolker at ufl.edu> wrote:
> John Zabroski <johnzabroski <at> gmail.com> writes:
> > The best clue I have so far is Rtips #5.9:
> > http://pj.freefaculty.org/R/Rtips.html#5.9 which is what I based my present
> > solution off of.
> >
> > However, I do not understand how this works.  It seems like there is no
> > concrete way to determine the arrow drawing parameters x0 and x1 for a
> > barplot.  Moreover, the bars seem to be "cut off".
> >
>   barplot() returns the x values you need for x0 and x1.
> barplot(...,ylim=c(0,xbar+se)) will set the upper y limit so
> the bars don't get cut off.
>   P.S. I hope you're not hoping to infer a statistically
> significant difference among these groups ...
>   cheers
>    Ben Bolker

Thanks a lot!  I tried all three and they all seem very dependable.
Also, I appreciate you rewriting my solution and adding elegance.

Is there a way to extend the tick marks to the ylim values, such that
the yscale ymax tickmark is something like max(xbar+se)?  In the
documentation, I thought par(yaxp=c(y0,y1,n)) would do the trick, but
after trying to use it I am not sure I understand what yaxp even does.

P.S. I am not looking for statistically significant differences.  I am
trying to learn how to leverage R's graphing capabilities.  I also
appreciate Frank Harrell referring me to the link about Dynamite Plots
and associated weaknesses.

More information about the R-help mailing list