Statalist


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

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


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: How to Plot: One dummy, different markers for different values, over time, by individual states
Date   Thu, 9 Jul 2009 08:51:21 +0000 (GMT)

--- On Thu, 9/7/09, Green Alexandra wrote:
> I am trying to make a plot with a panel from 1970 to 2000
> with an annual rain-fall dummy for all states in the U.S.,
> the dummy = 1 if above a threshold amount; = -1 otherwise.
> 
> Essentially, I am hoping to generate one plot/table that
> shows all the years on the on the x-axis;
> on the y-axis, it would plot the dummy for each state on
> the SAME line, but uses a different marker symbol  for 
> when the dummy value is 1 versus when dummy is -1. 

*--------------- begin example --------------
// create some example data
drop _all
input state year unusualrain 
      1     1970 1           
      1     1971 0           
      1     1972 0           
      2     1970 1           
      2     1971 1           
      2     1972 1
      3     1970 0
      3     1971 0
      3     1972 1
end

label define state 1 "foo" ///
                   2 "bar" ///
                   3 "bla"
label value state state

// create the graph
twoway scatter state year if unusualrain == 1 || ///
       scatter state year if unusualrain == 0, ///
       ylab(1/3, valuelabel)
*-------------- 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/



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