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

st: graph hbar and (xy)common


From   Ulrich Kohler <[email protected]>
To   [email protected]
Subject   st: graph hbar and (xy)common
Date   Wed, 10 Dec 2003 12:14:29 +0100

hi all,

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. 

An ideas highly appreciated,

regards
uli

-- 
[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