[R] bar plot colors

hadley wickham h.wickham at gmail.com
Mon Dec 17 22:14:12 CET 2007


> I have a question regarding colors in bar plots.  I want to stack a
> total of 18 cost values in each bar. Basically, it is six cost types and
> each cost type has three components- direct, indirect, and induced
> costs.  I would like to use both solid color bars and bars with the
> slanted lines (using the density parameter).  The colors would
> distinguish cost types and the lines would distinguish
> direct/indirect/induced.  I want the cost types (i.e. colors) to be
> stacked together for each cost type.  In other words, I don't want all
> of the solid bars at the bottom and all of the slanted lines at the top.

What are you trying to achieve with such a plot?  A stacked bar chart
only allows easy comparisons of cumulative totals (eg. cost 1, or cost
1 + 2, or cost 1 + 2 + 3) and it will be very difficult to compare
individual cost types or components within a type.  You might want to
think about a series of line plots instead.

Hadley

-- 
http://had.co.nz/



More information about the R-help mailing list