# Re: st: advanced (for me that is) graphing

 From Nick Winter <[email protected]> To [email protected] Subject Re: st: advanced (for me that is) graphing Date Tue, 12 Jan 2010 15:43:20 -0500

Interestingly, the table you include makes a nice "plot" itself, showing, more or less, the distribution by decade.
```
```
Continuing along that line, and rather differently from what you are asking for, violin plots are another way to show distributions over time (or against anything). My -vioplot- from SSC will do them.
```
Nick Winter

moleps wrote:
```
```Dear listers,
```
I´m trying to create a graph with age on the y axis and time on the x axis (year). So far so good, the problem is that I´d like each year to be represented with the distribution of age on the y axis. I was thinking color coding the number of people within each 10-year category on the y axis, and having the colors with the associated numbers in the legend. preferably all within a twoway graph so that I could also superimpose the median in the end.
```egen agecut=cut(age),at(0(10)100)

gives me this

tab agecut Ye

|                               Year
agecut | 1953-1969  1970-1979  1980-1989  1990-1999  2000-2004  2005-2009 |     Total
-----------+------------------------------------------------------------------+----------
```
0 | 23 19 16 7 6 3 | 74 10 | 32 17 7 11 2 6 | 75 20 | 43 39 38 17 9 4 | 150 30 | 110 59 77 66 21 21 | 354 40 | 213 129 153 177 78 54 | 804 50 | 444 301 259 273 193 144 | 1,614 60 | 342 330 427 375 211 215 | 1,900 70 | 72 104 193 257 149 139 | 914 80 | 2 13 12 26 33 40 | 126 90 | 0 1 0 1 0 1 | 3 -----------+------------------------------------------------------------------+---------- Total | 1,281 1,012 1,182 1,210 702 627 | 6,014
```I cannot get my head around to figuring out how to maintain age on the y-axis and have the frequencies color coded instead of having the frequencies on the y-axis and the age categories in the legend. Any ideas?

//M

*
*   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/
```
```
--
--------------------------------------------------------------
Nicholas Winter                                 434.924.6994 t
Assistant Professor                             434.924.3359 f
Department of Politics                  [email protected] e
University of Virginia          faculty.virginia.edu/nwinter w
PO Box 400787, 100 Cabell Hall
Charlottesville, VA 22904

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