[R] Christmas tree graphs

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Aug 28 09:26:35 CEST 2001



"Andrew C. Ward" wrote:
> 
> Hello R users,
> 
> I wish to draw a type of horizontal bar chart for two groups (males and
> females). The values for one group will start at the y-axis and point to the
> left, and the values for the other group will start at the y-axis and point to
> the right. If you're (un)lucky, the resulting graph can assume the shape of a
> Christmas tree.
> 
> The data are
>         left.side <- c(107092, 113053, 121163, 112209, 106543, 72895, 46920,
> 32606, 11106, 1134, 60, 5247)
>         right.side <- c(102129, 109261, 123291, 117322, 110397, 71027, 50319,
> 43805, 21074, 3621, 204, 6608)
> 
> The R function barchart allows me to stack bars and to juxtapose them, but I
> can't see how to draw the bars outwards from a centreline. If anyone had some
> hints on how to do this, I would be very grateful. Thank you!


  barplot(matrix(c(-left.side, right.side), ncol=2), horiz=TRUE, 
    beside=TRUE, space=c(0,-length(left.side))

Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list