[R] bar plot colors

John Kane jrkrideau at yahoo.ca
Wed Dec 19 15:52:40 CET 2007


--- Jim Lemon <jim at bitwrit.com.au> wrote:

> John Kane wrote:
> > 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
> > difficult to read.  
> > 
> > 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)
> > 
> >
>
=======================================================
> Very nice John, but it does look like someone
> dropped the M&Ms.
> Jim

Please I'm Canadian, we have Smarties. Much nicer than
M&Ms :)  

It is a bit garish but I didn't see a fast way to turn
off the colours on the axis though from the Help it
looks possible.



[[replacing trailing spam]]



More information about the R-help mailing list