# [R] bar plot colors

John Kane jrkrideau at yahoo.ca
Tue Dec 18 17:24:05 CET 2007

```I think you're going to find that barchart with that
many values in a bar is going to be pretty well
uninterpretable.

Jim Lemon gives the desired barchart but it is very

Stealing his code to create the same matrix I'd
suggest may be looking at a dotchart.  I'm not sure if
this is even close to an optimal solution but I do
think it's a bit better than a barchart approach
======================================================
heights<-matrix(sample(10:70,54),ncol=3)
bar.colors<-rep(rep(2:7,each=3),3)
cost.types <- c("Direct", "Indirec", "Induced")
colnames(heights) <-  c("A", "B", "C")
rownames(heights) <- c(rep(cost.types, 6))

dotchart(heights, col=bar.colors, pch=16, cex=.6)

=======================================================
--- "Winkel, David" <WinkelD at BATTELLE.ORG> wrote:

> All,
>
>
>
> 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.
>
>
> So far, I have made a bar plot with all solid colors
> and then tried to
> overwrite that bar plot by calling barplot() again
> and putting the white
> slanted lines across the bars.  However, I can't get
> this method to work
> while still grouping the cost types together.
>
>
>
>
>
>
> David Winkel
>
> Applied Biology and Aerosol Technology
>
> Battelle Memorial Institute
>
> 505 King Ave.
>
> Columbus, Ohio 43201
>
> 614.424.3513
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help