Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Antonio Rodriguez Andres" <Antonio.Andres@emu.edu.tr> |
To | <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: RE: to change bar colors in a histogram |
Date | Fri, 14 Feb 2014 21:32:04 +0200 |
Imagine I want to create a histogram for a variable such as job satisfaction with 5 levels. histogram jobsatisfaction, discrete percent xlabel (1 "Completely satisfied" 2 "Satisfied"....etc the idea is to plot the different bars for different levels of job satisfaction with different colors Antonio -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Radwin, David Sent: Friday, February 14, 2014 9:19 PM To: statalist@hsphsun2.harvard.edu Subject: st: RE: to change bar colors in a histogram Antonio, I am not sure I understand your situation, but it sounds like instead of a histogram with 2 bars, you want a graph of proportions. Try -catplot- (Nick Cox, available from SSC), perhaps with the -asyvars- option to show different colors. David -- David Radwin, Senior Research Associate Education and Workforce Development RTI International 2150 Shattuck Ave. Suite 800, Berkeley, CA 94704 Phone: 510-665-8274 www.rti.org/education > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner- > statalist@hsphsun2.harvard.edu] On Behalf Of Antonio Rodriguez Andres > Sent: Friday, February 14, 2014 10:43 AM > To: statalist@hsphsun2.harvard.edu > Subject: st: to change bar colors in a histogram > > Dear Stata users > > I am trying to create a histogram for the proportion of the population > having mental health problems (Yes or No). The mental health measure > is binary. I want to create a simple histogram with the bar color > different for each response Yes or No. That is my Stata code > > histogram MENTAL, discrete bcolor(blue) barw(0.5) addlabel percent > xlabel > (1 > "Yes" 0 "NO") title("Mental Health Problems: Total Population") > > Any advice > > Thanks in advance > > Antonio * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/