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: multigroup histogram
From
Scott Merryman <[email protected]>
To
[email protected]
Subject
Re: st: multigroup histogram
Date
Tue, 4 Jan 2011 12:39:28 -0600
Here is another way:
sysuse nlsw88,clear
tempfile tmp
preserve
xcontract grade, f(count) p(percent) nomiss saving(`tmp',replace)
restore
xcontract grade, f(count) p(percent) nomiss norestore by(race)
append using `tmp'
twoway bar percent grade if race == ., barw(.5) color(gs10) ///
|| scatter percent grade if race == 1, mc(black) ms(D) ///
|| scatter percent grade if race == 2, mc(black) ms(O) ///
|| scatter percent grade if race == 3, mc(black) ms(T) ///
||, legend(order(1 "All Races" 2 "White" 3 "Black" 4 "Other") row(1) ) ///
ylabel(, format(%9.0g) nogrid angle(h)) graphregion(color(white))
Scott
> On Mon, Jan 3, 2011 at 5:12 PM, tigerstale <[email protected]> wrote:
>> Hello. I'm trying to generate a multi-group bar graph. Specifically, I want
>> the main graph to show the frequency distribution across a categorical
>> variable (23 occupational categories); I then want to superimpose
>> circles/diamonds representing the same distribution for subgroups
>> (black/white). In other words, the primary bar graph (histogram) would
>> represent the frequency distribution for the full sample; there would be
>> circles to indicate where the frequencies would fall for blacks and diamonds
>> to indicate where the frequencies would fall for whites.
>>
*
* 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/