[R] Barplot coloring question

Marc Schwartz mschwartz at medanalytics.com
Tue Jul 30 14:59:18 CEST 2002


> -----Original Message-----
> Hi all,
> 
> SNIP
>
> In both cases, I want the distance between the bars A-A, B-B, C-C, to
be
> closer to each other than the A-B, B-C distance, and I want to
alternate
> colors, so that the first A has color x and the second A has a
different
> color y. The x, y colors must alternate after that: the first B has x,
> then the second B has y, etc.
> 
> However, in data3, I also want the three rows for a given column to
appear
> *within* a single bar, in three colors, say, c1, c2, c3, and the
column
> next to this column should have colors c4, c5, c6. So, now we want the
> triplets <c1, c2, c3>, <c4,c5,c6> alternating for each successive bar.
The
> reason for this is that we want to display two related but different
> percentages in the same graph, and we want to do this because then we
> can
> quickly eyeball the graph and get maximum information from a single
graph,
> rather than having to pore over dozens of them and to compare bars
> pairwise across different graphs (a sure way to lose your mind).
>
> SNIP
> 
> On Mon, 29 Jul 2002, Marc Schwartz wrote:
> 
> > The question this whole process now raises is why the inner loop?
> 
> Does the above explanation answer that question?

Absolutely.  Thanks for the clarification.  I had a feeling that was
where you were headed, but was not sure.  The thing that confused me at
first was that the colormatrix values in your prior message had the same
three colors repeated for each column. Now that I see that they are
alternating sets of three colors the need for a matrix as opposed to a
vector becomes clear and it all makes more sense.

> SNIP
>
> Marc, I want to thank you again for the enormous amount of time you
put
> into this, and for your extraordinary patience as you educated me on
> these revisions to the code. It would have taken much, much longer to
> figure all this out without your help.

You are very welcome.  Glad that I could be of help and assist you in
finding a working solution.

A significant part of the thanks goes to the R core group, as without
the open source approach of this whole project, we would not have access
to the source code. Therefore, we might not be able to resolve this
issue as we have without having to write a whole new barplot function
from scratch. That would have taken substantially longer.

Best regards,

Marc


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list