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: graph hbar, over, and bar coloring
From
<[email protected]>
To
<[email protected]>
Subject
st: graph hbar, over, and bar coloring
Date
Wed, 2 Mar 2011 11:49:12 -0000
I have -graph hbar- commands that look like
gr hbar percent ,
///
over(period) over(agegp3) missing scale(.75) ///
ytitle("Percentage") ylabel(0(10)80) ytick(0(5)80) ///
scheme(s2mono) graphregion(color(white) )
where period takes on 5 values, and agegp3 takes on 6 values. Nicely
plotted are the bars for each period within each age group. Ideally,
however, I would like to plot the first 3 bars corresponding to the
first 3 values of period to be shown in black, and the last 2 bars
corresponding to the last 2 values of period to be shown in grey.
Simply adding a -bar(#, color(..))- option to the command does not
produce what I want. Suggestions please. Or is it not possible to
combine barcolor options as I wish when -over()- options are also used?
I've looked in Michael Mitchell's book, 2/e, section 5.8. on changing
the look of bars, and this suggests to me that I need to define
"percent" separately for different values of period (say percent1 and
percent2). E.g.
gen percent1 = percent if inlist(period, 1, 2, 3)
gen percent2 = percent if inlist(period, 4, 5)
However when I did this (-gr hbar percent1 percent2, ... etc....) there
was no colour change as I'd hoped, and the bars were thinner.
For similar issues, cf.
. sysuse auto, clear
(1978 Automobile Data)
. gr hbar weight, over(foreign)
. gr hbar weight, over(foreign) bar(1, color(black)) bar(2, color(gs8))
I would have hoped that the bar coloring would cycle within the over
group, but it doesn't.
Stephen
------------------
Stephen P. Jenkins <[email protected]>
Department of Social Policy and STICERD
London School of Economics and Political Science
Houghton Street
London WC2A 2AE
United Kingdom
Tel: +44(0)20 7955 6527
Survival Analysis Using Stata:
http://www.iser.essex.ac.uk/survival-analysis
Downloadable papers and software: http://ideas.repec.org/e/pje7.html
Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer
*
* 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/