Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: Univariate distribution graphs in a twoway environment?

From   <>
To   <>
Subject   st: Univariate distribution graphs in a twoway environment?
Date   Mon, 7 Oct 2013 13:37:35 +0200

Dear Statalisters,

I was asked to display the age distributions (e.g. kdensity, histogram ...) of several subgroups in one graph. 
Age is scaled on the x-axis, another numeric variable on the y-axis. 

The nearest example I found to explain this is -twoway rcap- :

      sysuse sp500, clear
      gen num = _n
	  keep if uniform() <.05	  
       twoway rcap high low num, hor ylabel(,angle(0)) || scatter  num close

In this case the y-var 'num' defines the vertical position of each rcap.

Now exchange each rcap with e.g. a kdensity curve (not available with the given data) and it would be what I'm looking for.
The y-var determines the vertical position of each curve but not it's scaling.
I didn't find any way to create a graph like this.

Another example would be to place diagrams inside a graph where x/y determines the position only.
Again I don't know how to make this, but I know that -spmap- draws basic diagrams on a map using centroid coordinates.

Best wishes

Stefan Gawrich

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index