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: changing bar order on twoway bar chart
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: changing bar order on twoway bar chart
Date
Tue, 18 Sep 2012 20:44:42 +0100
The essence of the problem is (likely to be that) you need a variable
-- say -axis2- -- that defines the order of the bars even if you need
to type in yourself as 1,2,3,4,5...
Nick
On 18 Sep 2012, at 19:14, Ben Cooper <[email protected]> wrote:
I have a graph dilemma that I can not solve. I have successfully
used the syntax below from the URL (http://www.survey-design.com.au/Stata%20Graphs.html
) to create a two-way horizontal bar chart depicting odds ratios and
CIs above and below the value of 1.
twoway bar estimate axis, base(1) horizontal barw(.70) color("0 0
192") scheme(s1color) ///
xline(1) ylab(, valuelabel angle(0)) || ///
rcap min95 max95 axis, horizontal lwidth(medthick) lcolor
("255 127 0") msize(large) ///
title("Outcome: Disconnected") ///
legend(order(1 "point estimate" 2 "95% CI") pos(6))
The problem is that Stata sorts the bars in order of the magnitude
of the odds ratio and this simply will not work for my project. I
know I can do custom bar sorting with the 'graph hbar x, over(y)'
command but then I lose the ability to use the rcap option for error
bars and the base(1) option to set the bars starting at 1 (since
they are ORs). I have tried creating each bar separately and putting
all on one graph but Stata still continues to sort the bars based on
the value in the variable estimate. I certainly like all the
features of the twoway bar approach, except this one issue of not
being able to sort the bars.
*
* 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/