# RE: st: How to Plot: One dummy, different markers for different values, over time, by individual states

 From Maarten buis To statalist@hsphsun2.harvard.edu Subject RE: st: How to Plot: One dummy, different markers for different values, over time, by individual states Date Thu, 9 Jul 2009 12:31:17 +0000 (GMT)

--- On Thu, 9/7/09, Nick Cox wrote:
> That said, it's worth pondering the syndrome that Howard
> Wainer has repeatedly stigmatised as "Alabama first!" -- the
> exact words in this case.

For example your graph would probably be a lot clearer if you
sort the states with regard to the total number of years with
unusual rain. Below is an example that does that. To run it
you will need to install the -egenmore- package from SSC, by
typing in Stata -ssc install egenmore-.

*----------------- begin example ----------------
// create some example data
drop _all
input str10 state   year unusualrain
"Alabama"     1970  1
"Alabama"     1971 -1
"Alabama"     1972 -1
"California"  1970  1
"California"  1971  1
"California"  1972  1
"New York"    1970 -1
"New York"    1971  1
"New York"    1972  1
end

// creating a variable counting per state the total
// number of years with unusual rain
gen zero_one = unusualrain == 1 if unusualrain < .
bys state : egen tot = total(zero_one)

// create a variable for the y-asis that sorts
// states on the total number of years with
// unusual rain
egen axis_state = axis(tot state), label(state)

// create the graph
twoway scatter axis_state year if unusualrain == 1 || ///
scatter axis_state year if unusualrain == -1,  ///
ylab(1/3, valuelabel)                          ///
legend(order( 1 "much rain" ///
2 "little rain" ))
*------------------ end example --------------------

Hope this helps,
Maarten

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

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

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