Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: graph hbar and (xy)common


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   Re: st: RE: graph hbar and (xy)common
Date   Fri, 12 Dec 2003 09:09:37 +0100

Thank you Nick, Vince, and Allan for answering my question.

Following a suggestion from Nick, I found a solution with -twoway bar- which 
was good enough for me, albeit not what I have initially intended. 

twoway ///
  (bar hsatcc cnew, horizontal base(`min') blcolor(black) bfcolor(white)) ///
  (bar hsateu cnew, horizontal base(`min') blcolor(black) bfcolor(black)) ///
  (dot hsatagg cnew, horizontal base(`min')), ///
  legend(off) ///
  yline(29, lstyle(foreground)) ///
  ylab(1(1)28 30(1)33, valuelabel angle(horizontal) axis(1)) ///
  xtitle("") ytitle("") ///
  ysize(7) xlab(#5, grid)
exit

That is, I designed a categorical variable (cnew) to order the countries along 
the vertical axis. I left one category empty in this cnew which gives me 
space between the dot-plot part and the bar-blot part,  In this space I 
ploted a line in the foreground. 

I did not follow Vince's suggestion. The graphs has to be inserted into a Word 
document which has to be sent to a third party who is going to make a 
internet page from it. Visually alinging the plot regions seems to be not 
robust enough for this purpose.

many regards
uli

> > I have two graphs, produced with -graph hbar- and want to
> > combine them
> > underneath each other in one single graph. The first graph plots 28
> > country-means of a measurment, the second graph plots means
> > of the same
> > measurment for 4 groups of countries (i.e. European Union etc.)
> >
> > What I want to have is something like the following (Please
> > use fixed-font):
> >
> >
> >                  +-----------------------------------+
> >          Romania |###################                |
> >          Bulgaria|##########                         |
> >
> >               :  |########                           |
> >               :  |#######                            |
> >               :  |####                               |
> >
> >   United Kingdom |##                                 |
> >                  +-----------------------------------+
> >                  +-----------------------------------+
> >               EU |##                                 |
> >
> >               :  |###############                    |
> >
> >               CC |#######                            |
> >                  +-----------------------------------+
> >
> > However, since the labels of the second graph are much
> > shorter than those of
> > the first, I end up with a picture like this:
> >
> >                  +-----------------------------------+
> >          Romania |###################                |
> >          Bulgaria|##########                         |
> >
> >               :  |########                           |
> >               :  |#######                            |
> >               :  |####                               |
> >
> >   United Kingdom |##                                 |
> >                  +-----------------------------------+
> >            +-----------------------------------------+
> >         EU |##                                       |
> >
> >         :  |###############                          |
> >
> >         CC |#######                                  |
> >            +-----------------------------------------+
> >
> > Unfortunately I couldn't found a way to control the
> > starting coordinate of the
> > numerical y-axis in the graph-region (an analogon to the
> > cstart()-option in
> > Nicks -hplot- for stata 7.). The xcommon-option of -graph
> > combine- only
> > scales the axis idenitically, but does not control the
> > starting coordinate of
> > the x-axis.
> >
> > Here is what I did so far:
> >
> > ------------------------------------------------------------
> > -----grhealts.do----
> > separate hsat, by(eu)
> >
> > graph hbar (asis) hsat0 hsat1 ///
> > if eu < . , ///
> > over(country, sort(hsat)) nofill legend(off) ///
> > name(countries, replace) yalternate
> >
> > graph dot (asis) hsat ///
> > if eu >= . , ///
> > over(country, sort(country)) nofill legend(off) fysize(20) ///
> > name(aggregates, replace)
> >
> > graph combine countries aggregates, xcommon rows(2) cols(1)
> > imargin(0 0 0 0)
> > ------------------------------------------------------------
> > -----------------------
> >
> > I also tried to change the contents of the Country-Variable
> > by putting blanks
> > in front of "EU", that is:
> >
> > . replace country = "         EU" if country == "EU"
> >
> > However this attempt wasn't successful as -graph- seems to
> > treat those blanks a just one.
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/

-- 
[email protected]
+49 (030) 25491-361


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index