I see what your suggesting.  Make the rain negative so that it plots on the
other side of the axis.  The axis labels can be adjusted accordingly.  That
makes it simple.  Thanks for the help.


On Mon, Apr 26, 2010 at 3:49 PM, Greg Snow <greg.s...@imail.org> wrote:

> Does this do what you want?
>
> rainsnow <- rbind( c(0,1,2,3,2,1,0), c(2,2,1,0,0,1,2) )
>
> rainsnow2 <- rbind( rainsnow[1,], -rainsnow[1,], -rainsnow[2,] )
>
> fig=barplot(rainsnow2, horiz=TRUE, space=0, col=c("grey70",NA,
> "white"), axes=FALSE)
>
> --
> Gregory (Greg) L. Snow Ph.D.
> Statistical Data Center
> Intermountain Healthcare
> greg.s...@imail.org
> 801.408.8111
>
>
> > -----Original Message-----
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> > project.org] On Behalf Of Kevin Turner
> > Sent: Saturday, April 24, 2010 1:04 PM
> > To: r-help@r-project.org
> > Subject: [R] barplot - offsetting individual bars
> >
> > Hello,
> >
> > I'm trying currently using barplot to summarize precipitation data.  So
> > far
> > I've compiled total annual snow and rain accumulation in a table
> > (attached).  I've been successful at plotting it using the following
> > code:
> >
> > fig=barplot(t(Annual_Precip_table), horiz=TRUE, space=0,
> > col=c("grey70",
> > "white"), axes=FALSE)
> > .
> > .
> > The result is a stacked barplot with total annual rain represented by
> > grey
> > bars and total annual snow represented by white bars.  This is great,
> > however, I'd like to position the bars so that the rain bars are right
> > justified on the axis and the snow bars are left justified on the axis.
> >
> > I looked around for ways to do this, and I'm not sure, but is plotrix
> > capable of doing it using the barb function?  Does anyone have
> > experience
> > with this kind of plot?
> >
> > Thanks.
> >
> > --
> > Kevin Turner
> > Department of Geography
> > and Environmental Studies
> > Wilfrid Laurier University
> > Waterloo, Ontario
>



-- 
Kevin Turner
Department of Geography
and Environmental Studies
Wilfrid Laurier University
Waterloo, Ontario

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to