Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: row and column titles for graphs with the by option


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   stata list <statalist@hsphsun2.harvard.edu>
Subject   st: row and column titles for graphs with the by option
Date   Wed, 21 Oct 2009 14:46:43 -0700 (PDT)

Does anyone know a trick to create the following graph? Start with
the graph in the example below. 

*--------------- begin example ----------------
sysuse auto, clear
recode rep78 1/2=3
label define rep78 3 "average" 4 "good" 5 "excelent"
label value rep78 rep78
scatter price mpg , by(foreign rep78) name(rowcol, replace)
*---------------- end example -----------------

Notice that there is quite a bit of redundancy in the information 
contained in the graph titles. So I was thinking of a graph where
the columns where labeled on the top as "average", "good", 
"excelent", and the rows where labeled on the right as "domestic", 
and "foreign". 

The example below shows how to create those "column titles", but
I am struggling with "row titles".

*----------------- begin example ---------------------
sysuse auto, clear
recode rep78 1/2=3
egen byvar = group(foreign rep78)
label define byvar 1 "average" 2 "good" 3 "excelent" ///
                   4 " " 5 " " 6 " "
label value byvar byvar
scatter price mpg , by(byvar) name(col, replace)
*------------------ end example -----------------------

-- Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

http://www.maartenbuis.nl
--------------------------


      

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



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