Statalist


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

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


From   moleps <[email protected]>
To   [email protected]
Subject   Re: st: advanced (for me that is) graphing
Date   Wed, 13 Jan 2010 19:43:12 +0100

The histogram command ala Nick Cox is closest to what I want to convey, However since there are 56 years along the x-axis it doesnt look very nice. I could graph by decades, but all my other graphs are on individual years.  Also I´m not able to superimpose other plots on the same graph.



Regards

M
 
On 13. jan. 2010, at 18.33, Nick Cox wrote:

> There are several other possibilities too. For example, -histogram- itself is much more flexible than is widely known: 
> 
> . sysuse auto
> (1978 Automobile Data)
> 
> . histogram mpg, by(rep78, compact row(1)) yla(, ang(h)) width(2) xsc(r(0 11)) freq horizontal
> 
> Also, check out -tabplot- from SSC. 
> 
> Nick 
> [email protected] 
> 
> Nick Winter
> ===========
> 
> 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.
> 
> Maarten Buis
> ============
> 
> Sounds like a case for Nick Cox's -stripplot-, which you can download from SSC by typing in Stata: -ssc install stripplot-.
> The help-file contains many examples.
> 
> Moleps Islon
> ============
> 
> 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?
> 
> *
> *   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