Murali--
Something like this may do what you want:
sysuse auto, clear
g r=gear_ratio*10
twoway__histogram_gen r, gen(y1 x1) start(12) w(1) freq
twoway__histogram_gen mpg, gen(y2 x2) start(12) w(1) freq
tw bar y2 x2 || bar y1 x1
replace x2=x2-.25
replace x1=x1+.25
tw bar y2 x2, barw(.5) || bar y1 x1, barw(.5)
On Tue, Nov 25, 2008 at 3:40 PM, David Airey <[email protected]> wrote:
> It will probably serve just as well to plot two kernel density functions. I
> know two of those can be plotted in the same graph.
>
> Dave
>
> On Nov 25, 2008, at 2:27 PM, Murali Kuchibhotla wrote:
>
>> Hello,
>> I am trying to plot 2 histograms on the same graph using the addplot
>> option as follows:
>>
>> hist math_grade if MATH_cat==2 & course=="econ_10", addplot(hist
>> math_grade if MATH_cat==2 & course=="psych_101") freq addl
>>
>> However, when I run this I get the same graph as when I run:
>>
>> hist math_grade if MATH_cat==2 & course=="econ_10",freq addl
>>
>> Can someone please tell me what I am doing wrong? Also, is there a way to
>> represent the bars of the 2 histograms in different colors? Thanks.
>>
>> Murali Kuchibhotla
>>
>>
>> *
>> * 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/
>
*
* 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/