Skip to content

barplot colors

6 messages · Francois de Ryckel, Rui Barradas, David L Carlson +1 more

#
Hello,

According to the code in file src/R/graphics/barplot.R, barplot() will 
draw column by column, and threfore use as many colors as rows in the 
matrix. Those colors will be reused for all bars. So I'm not seeing an 
easy way of doing what you want using base graphics. Not without 
changing the code for barplot().


Hope this helps,

Rui Barradas

Em 26-03-2013 18:09, Francois de Ryckel escreveu:
#
You will have to trick barplot into thinking you have four groups:
----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352
#
Hello,

I forgot to add that if you use argument beside = TRUE, you can have as 
many colors as there are bars, but this is not the kind of graph you 
want. (This behavior makes a lot of sense if you look at the underlying 
code for barplot.)

Rui Barradas

Em 26-03-2013 19:39, Rui Barradas escreveu:
#
Hi David,
Thanks a lot for your advice and helping me tricking barplot.  It totally work. 
Have a great evening!
Fran?ois
On 26 Mar 2013, at 21:43, David L Carlson wrote:

            
#
Hi Rui,
Thanks for trying.  I know about the beside.  The reason I want them stack with various colors is that the 4 stacks represent the number of students on each quartiles on a test. 
Have a terrific Tuesday!
Fran?ois
On 26 Mar 2013, at 21:45, Rui Barradas wrote: