[R] Barchart to make a graph like this??

Deepayan Sarkar deepayan at stat.wisc.edu
Tue May 13 17:52:19 CEST 2003


On Tuesday 13 May 2003 03:00, knussear at biodiversity.unr.edu wrote:
> Hi list,
>
> I'm trying to get R to make a graph like the one shown in this pdf, where
> males are white bars and females are black bars.
>
> http://www.brrc.unr.edu/~knussear/mmgraph.pdf
>
> I tried barchart, but I couldnt get the bars to share a common x axis.

I'm assuming by this you mean barchart in the lattice package.

> Do you have any suggestions?

Some information on the form of your data would have helped.

This is not the standard form of a barchart, so you need to fudge some things. 
First of all, make the values in one of the groups (the ones you want on the 
left) negative. Then barchart with groups (or use + in the formula, depending 
on the form of your data), stack=TRUE should give you what you want. Of 
course, the axis labels will be negative, you need to control those using 
scales.

HTH,

Deepayan




More information about the R-help mailing list