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]

st: RE: RE: RE: RE: RE: to change bar colors in a histogram


From   "Antonio Rodriguez Andres" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: RE: RE: to change bar colors in a histogram
Date   Fri, 14 Feb 2014 21:50:20 +0200

Thank you. It works fine. Is there any way to rotate the graph using catplot?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Radwin, David
Sent: Friday, February 14, 2014 9:42 PM
To: [email protected]
Subject: st: RE: RE: RE: RE: to change bar colors in a histogram

Sorry, change that last line to:

catplot rep78, asyvars bargap(20) blabel(bar) showyvars legend(off) percent

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: [email protected] [mailto:owner- 
> [email protected]] On Behalf Of Radwin, David
> Sent: Friday, February 14, 2014 11:41 AM
> To: [email protected]
> Subject: st: RE: RE: RE: to change bar colors in a histogram
> 
> Try this:
> 
> ssc install catplot
> 
> sysuse auto, clear
> 
> label define rep78 1 "Completely satisfied" 2 "Somewhat satisfied" 3 
> "Neutral" 4 "Somewhat dissatisfied" 5 "Completely dissatisfied"
> 
> label values rep78 rep78
> 
> catplot rep78, asyvars bargap(20) blabel(bar) showyvars legend(off)
> 
> 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: [email protected] [mailto:owner- 
> > [email protected]] On Behalf Of Antonio Rodriguez 
> > Andres
> > Sent: Friday, February 14, 2014 11:32 AM
> > To: [email protected]
> > Subject: st: RE: RE: to change bar colors in a histogram
> >
> > 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: [email protected] [mailto:owner- 
> > [email protected]] On Behalf Of Radwin, David
> > Sent: Friday, February 14, 2014 9:19 PM
> > To: [email protected]
> > 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: [email protected] [mailto:owner- 
> > > [email protected]] On Behalf Of Antonio Rodriguez 
> > > Andres
> > > Sent: Friday, February 14, 2014 10:43 AM
> > > To: [email protected]
> > > 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/
> 
> *
> *   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/



*
*   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/


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