Statalist


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

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


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: row and column titles for graphs with the by option
Date   Wed, 21 Oct 2009 21:07:43 -0500

Here a brute force method:

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, ///
 r1title("Foreign                          Domestic", ///
 box size(small) bmargin(0 0 5 5) lcolor(none) bexpand) ) ///
 name(col, replace)


Scott


On Wed, Oct 21, 2009 at 4:46 PM, Maarten buis <[email protected]> wrote:
> 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/
>

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index