[R] Barplot colours

Jim Lemon jim at bitwrit.com.au
Thu Feb 25 12:30:58 CET 2010


On 02/25/2010 08:59 PM, koj wrote:
>
> Hi all,
>
> my plotbase (height) is a 2x2 matrix and I want to draw a plot with
> different colours. I used beside = FALSE and so the elements (1,1) and (2,1)
> are in one bar and the elements (1,2) and (2,2) are in the other bar
> (stacked). This is no problem, if the first row has one colour and the
> second line has one colour. But now I want to draw the frist bar in one
> colour an the second bar in two different colours. Is there apossibility to
> do this? I tried to do this in providing a 2x2 matrix with different colours
> in the parameter "col" but without sucess.

Hi Jens,
You can pass a matrix of colors to the barp function in the plotrix package.

Jim



More information about the R-help mailing list