[R] Plot means with error bars - A novice needs help

Dylan Beaudette dylan.beaudette at gmail.com
Wed Oct 8 21:48:19 CEST 2008


On Wednesday 08 October 2008, Manuel Morales wrote:
> On Wed, 2008-10-08 at 09:49 -0700, Dylan Beaudette wrote:
> > On Wednesday 08 October 2008, Manuel Morales wrote:
> > > Another option is bargraph.CI or lineplot.CI from the package sciplot.
> > >
> > > See http://mutualism.williams.edu/sciplot for examples.
> > >
> > > On Tue, 2008-10-07 at 23:31 -0500, Michael Just wrote:
> > > > Hello,
> > > > I'd appreciate a suggestion on how to construct plots (barplots?)
> > > > that use means on the Y axis instead of density/count. I'd also like
> > > > to use groups and plot error or confidence interval bars on these
> > > > graphs. I know this is a read the manual situation. I'd appreciate
> > > > help with what to read, or your benevolence with some sample code.
> > > >
> > > > I've looked at lattice and gplots2, but given my beginner status my
> > > > efforts are not propelling me very far.
> > > >
> > > > Thank you kindly,
> > > > Michael Just
> >
> > # Personally, this looks more informative to me:
> > library(lattice)
> > bwplot(len ~ supp | factor(dose), data=ToothGrowth, layout=c(3,1))
> >
> > # and some people like this:
> > require(Hmisc)
> > bwplot(supp ~ len | factor(dose), data=ToothGrowth, layout=c(3,1),
> > panel=panel.bpplot, datadensity=TRUE)
>
> I guess personal preference but I prefer a layout that has them
> overlapping - visual comparison is easier.
>
> E.g.:
> require(sciplot)
> lineplot.CI(response=len, x.factor=dose, group=supp, data = ToothGrowth)
>
> If detail of the distributions are needed, the graphs you suggest are
> certainly warranted!

Indeed. Form must usually follow function. I see what you mean about having 
then on the same axis.

Thanks!

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341



More information about the R-help mailing list