Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: pattern-fills in stacked bar graph


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: pattern-fills in stacked bar graph
Date   Wed, 26 May 2010 19:17:56 +0200

<>

I do not think that Nick`s problem was with the names of the variables, but
the notion that one should stack means on top of each other. Here is an
example of the data that you seem to have. -twoway parea- does not seem to
be the answer, as far as I can tell.

********** 
clear*
set obs 10000

gen byte gender=_n>6000

gen gap_ed=cond(!gender,runiform()*10, runiform()*8)
gen gap_exp=cond(!gender,runiform()*5, runiform()*6)
gen gap_unknown=cond(!gender,runiform()*15, runiform()*3)

graph bar gap_ed gap_exp gap_unknown, over(gender) stack*

***********


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Natalie Doss
Sent: Mittwoch, 26. Mai 2010 19:11
To: [email protected]
Subject: Re: st: RE: pattern-fills in stacked bar graph

Yes, the variables should be called mean_gap_ed, etc..I used shortened
names to simplify.

On Wed, May 26, 2010 at 12:05 PM, Nick Cox <[email protected]> wrote:
> So, you are stacking _means_ ? Actually, that's not a question.
> You are stacking means. Is that what you want to do?
>
> Nick
> [email protected]
>
> Natalie Doss
>
> Thank you. Here is an example similar to my data, but simpler:
>
> x-variable: gender, taking values 0 and 1.
> y-variables: income gap, divided into 3 components:
> gap_ed,  gap_exp,  gap_unknown
>
> I am using Stata 10.0. Without trying to use pattern fills, this is
> very easy to do using the "bar graph" command. As in:
>
> graph bar gap_ed gap_exp gap_unknown, over(gender) stack
>
> On Wed, May 26, 2010 at 2:56 AM, Martin Weiss <[email protected]>
> wrote:
>
>> It is difficult to advise you on this, as we do not have your data.
> Maybe
>> give an excerpt. Also, you should say that -tw parea- is user-written
> by
>> Sergiy.
>
> Natalie Doss
>
>> I am trying to do a stacked bar graph with different pattern fills. I
> have 4
>> outcomes and 7 components to each outcome. I am confused about how to
> use
>> twoway
>> parea to make a bar graph. I believe I have to reorganize my data a
> fair
>> amount, but am unsure of what exactly I need. An earlier thread on
> this said
>> that the collapse and contract commands would be most useful, but I'm
> pretty
>> new to stata and am wondering if anyone has more specific ideas.
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>



-- 
Natalie Doss
The University of Chicago
Class of 2010
[email protected]
(352) 275-2620

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index