s-news
[Top] [All Lists]

different colors for bars in barplot, clarification

To: s-news@wubios.wustl.edu
Subject: different colors for bars in barplot, clarification
From: Jeff Simonoff <jsimonof@stern.nyu.edu>
Date: Thu, 20 May 2004 11:30:15 -0400 (EDT)
Hi again,
Based on replies I'm getting, I think that I need to clarify my question.
Consider the following situation: I have three questions of the form "I
like the color ...", using the colors red, green, and blue. Each of my
respondents can answer "Agree", "Neutral", "Disagree". I ultimately end up
with three sets of proportions:

                 Red     Green    Blue
       Agree     .4        .2      .6
       Neutral   .1        .5      .1
       Disagree  .5        .3      .3

If I call barplot() on this matrix, I will get a set of side-by-side
stacked bars, and can see graphically that there are more "Agree"s for
blue (the third bar in the plot), more "Disagree"s for red (the first bar
in the plot), and so on. Using barplot() I can control how the Agree,
Neutral, and Disagree categories are represented - filled in area, shaded
with different densities of lines, and so on. I can also code them in
different colors, but that's not what I'm asking. Say I decide to code
"Agree" with a filled-in box, "Neutral" with a diagonally shaded one, and
"Disagree" with a blank box. What I am looking for is the ability to do
those shadings in different colors (red for the first bar, green for the
second, and blue for the third). The reason is that then bar labels are
unnecessary (I'm using more than three colors, so labeling the bars would
be a problem). The col parameter in barplot seems to only control
different colors for the different rows in my matrix, and what I am
looking for is the ability to control it for the different columns.

BTW, I am using S-PLUS 6.2 Professional under Windows 98.

               Best,

               Jeff


==============================================================================
Jeffrey S. Simonoff                            Phone:  (212) 998-0452
Professor of Statistics
Leonard N. Stern School of Business            Fax:    (212) 995-4003
New York University
44 West 4th Street, Rm. 8-54                   e-mail: jsimonof@stern.nyu.edu
New York, NY 10012-0258
USA                                    WWW: http://www.stern.nyu.edu/~jsimonof
==============================================================================



<Prev in Thread] Current Thread [Next in Thread>
  • different colors for bars in barplot, clarification, Jeff Simonoff <=